polotek/libxmljs — pull request #225 by JoshData (2014-04-10 16:54:12+00:00)
Title: add an options argument to parseXml

This adds an options argument to parseXml so that xmlParserOptions can be pass.ed to libxml's underlying XML parsing function

The options argument, if provided, is an object whose keys correspond to flags defined in xml_document.cc. If the corresponding value of the key is true (or true-like), the corresponding xmlParserOption flag gets passed to xmlReadMemory.

Example:

libxmljs.parseXml(xml, {noblanks: true});

which is particularly useful when calling toString() to produce formatted output on the document later. If you parse an XML string that has indentation, insert some nodes, and then try toString() on it, it won't indent the new nodes properly unless `noblanks` is set in the options.

See:
http://xmlsoft.org/html/libxml-parser.html#xmlParserOption