xmlbuilder
An XML builder for node.js
xmlbuilder-js
An XML builder for node.js similar to java-xmlbuilder.
xmlbuilder2
:
Announcing The new release of xmlbuilder
is available at xmlbuilder2
! 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 xmlbuilder2
; xmlbuilder
will only receive critical bug fixes.
Installation:
npm install xmlbuilder
Usage:
var builder = ;var xml = builder;console;
will result in:
git://github.com/oozcitak/xmlbuilder-js.git
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.