Work with libmxmljs DOM as with plain Javascript objects.

npm install libxmljs-easy
1 downloads in the last day
18 downloads in the last week
133 downloads in the last month


libxmljs-easy is a Node.js module which simplifies XML traversing, similar to E4X.

Build Status


 npm install libxmljs-easy


Use module

 var easy = require("libxmljs-easy");

Parse XML

 var xml = easy.parse('<books><book name="Lord of the Rings">' +
                         '<author name="J. R. R. Tolkien" />' +
                         '<language>English</language>' +

Select elements from collections explicitly

 assert.equal([0].$name, "Lord of the Rings");
 assert.equal([0].author[0].$name, "J. R. R. Tolkien");

Use shorthands (works well for case when there is single child element with given name)

 assert.equal($name, "Lord of the Rings");
 assert.equal($name, "J. R. R. Tolkien");

Basically the idea is that you construct a path from tag names, which can optionally end with attribute name prefixed with "$".

When index is ommited – the array of elements is matched. When attribute is accessed on such array, its value is concatenated string of attribute values for each of elements in the array.

There is also original DOM element available as "$" property of individual converted elements.

 assert.equal([0].$.text(), "English");

Further info

npm loves you