An XML builder for node.js similar to java-xmlbuilder.
The new release of
xmlbuilder is available at
xmlbuilder2 has been redesigned from the ground up to be fully conforming to the modern DOM specification. It supports XML namespaces, provides built-in converters for multiple formats, collection functions, and more. Please see upgrading from xmlbuilder in the wiki.
New development will be focused towards
xmlbuilder will only receive critical bug fixes.
npm install xmlbuilder
var builder = ;var xml = builder;console;
will result in:
It is also possible to convert objects into nodes:
var builder = ;var obj =root:xmlbuilder:repo:'@type': 'git' // attributes start with @'#text': 'git://github.com/oozcitak/xmlbuilder-js.git' // text node;var xml = builder;console;
If you need to do some processing:
var builder = ;var root = builder;root;forvar i = 1; i <= 5; i++var item = root;item;item;var xml = root;console;
This will result in:
<!-- f(x) = x^2 -->
See the wiki for details and examples for more complex examples.