Skip to content

A command line tool for XML manipulations in Xembly, an imperative DSL

License

Notifications You must be signed in to change notification settings

yegor256/xembly.rb

Repository files navigation

DevOps By Rultor.com We recommend RubyMine

Gem Version Maintainability Test Coverage

Xembly is assembly for XML.

Read this blog post and check this project: yegor256/xembly

To install, you will need Ruby 2.0+:

$ gem install xembly

Then, run it and read its output:

$ xembly --help

Say, you want to modify an existing XML document, which is in the file doc.xml:

<books>
  <book isbn="0735619654">Object Thinking</book>
  <book isbn="1519166915">Elegant Objects</book>
</books>

Now, say, you want to add one more book there:

$ xembly --xml doc.xml 'XPATH "/books"; ADD "book"; ATTR "isbn", "0201379430"; SET "Object Design";'
<books>
  <book isbn="0735619654">Object Thinking</book>
  <book isbn="1519166915">Elegant Objects</book>
  <book isbn="0201379430">Object Design</book>
</books>

Simple as that!

The full specification of Xembly language is here.