xmlshim

Provides DOMParser, XMLSerializer and DOMImplementation wrappers in the browser and emulates them on the server-side

npm install xmlshim
2 downloads in the last day
3 downloads in the last week
71 downloads in the last month

Node XML Shim

This project brings the DOMParser1 and XMLSerializer2 objects known from the browser to node.js. Additionally functions from document.implementation, most importantly createDocument3 are exposed via this module.

XML Shim is ready to be browsified and therefore pretty useful for cross-platform projects.

DOMParser example:

var xmlshim = require('xmlshim');
var dp = new xmlshim.DOMParser();
var doc = dp.parseFromString('<hello-world/>', 'text/xml');
console.log(doc.firstChild.nodeName);

XMLSerializer example:

var xmlshim = require('xmlshim');
var xs = new xmlshim.XMLSerializer();
var doc = xmlshim.implementation.createDocument('', '', null);
var root = doc.createElement('hello-world');
doc.appendChild(root);
console.log(xs.serializeToString(doc));

Run the test suite:

Run the test suite under node.js:

make test

Run the test suite in firefox web browser (adapt the Makefile or point your browser manually at browser-test/test.html if you want to test in another browser):

make browser-test

Dependencies:

XML Shim depends on jsdom4 for the DOM bits as well as a on the xmlwriter-branch5 of libxmljs6 for serialization and parsing. Browserify7 and nodeunit is required in order to build and run the browser test suite.

npm loves you