Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
An XML builder for node.js
branch: master

This branch is 2 commits ahead, 237 commits behind oozcitak:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib Pushing js built from coffee
src Allow multiple builder instances
test Allow multiple builder instances
.gitignore Added
.npmignore Added .npmignore.
Makefile Added missing parenthesis. Closes # 9.
package.json Bumped version to 1.2


An XMLBuilder for node.js similar to java-xmlbuilder.


npm install xmlbuilder


I had to break compatibility while adding string escaping to version 0.1.0. As a result, version from v0.1.0 are not compatible with previous versions.


var builder = require('xmlbuilder');

    .att('for', 'node-js')
      .att('type', 'git')

console.log(builder.toString({ pretty: true }));

will result in:

  <xmlbuilder for="node-js">
    <repo type="git">git://</repo>

If you need to do some processing:

var root = builder.begin('squares');'f(x) = x^2');
for(var i = 1; i <= 5; i++)
  var item = root.ele('data');
  item.att('x', i);
  item.att('y', i * i);

This will result in:

  <!-- f(x) = x^2 -->
  <data x="1" y="1"/>
  <data x="2" y="4"/>
  <data x="3" y="9"/>
  <data x="4" y="16"/>
  <data x="5" y="25"/>
Something went wrong with that request. Please try again.