chbrown/xmlconv — pull request #1 by jefftimesten (2014-01-05 22:39:39+00:00)
Title: Allow libxml.Document and libxml.Element to be passed to xmlconv()

This makes it possible to convert sub-elements of a document that has already been parsed (using xpath or child-getters, etc).

I couldn't figure out tap, but this change allows something like this:

fs.readFile('test/data/media.xml', 'utf8', function(err, xml){
var doc = libxml.parseXml(xml);
var element = doc.get("//book[@id=1]");

var obj = xmlconv(element, {convention: 'parker'});
console.log(JSON.stringify(obj, null, ' '));
});

produces:

{
"title": "XML: The Good Parts",
"author": "Nulon Catorze",
"blurb": "\n This is an awesome book, you guys!\n "
}