Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A PURE JS W3C Standard based DOMParser and XMLSerializer (DOM Level2 CORE).
JavaScript
branch: master

This branch is 1 commit ahead, 114 commits behind jindw:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
__package__.js
dom-parser.js
dom.js
package.json
readme.md
sax.js

readme.md

Introduction

Another xml parser for nodejs/browser/rhino for java. Fully compatible with W3C DOM level2; and some compatible with level3. support DOMParser and XMLSerializer interface such as in browser.

Install:

npm install xmldom

Example:

var DOMParser = require('xmldom').DOMParser;
var doc = new DOMParser().parseFromString(
    '<xml xmlns="a" xmlns:c="./lite">\n'+
        '\t<child>test</child>\n'+
        '\t<child></child>\n'+
        '\t<child/>\n'+
    '</xml>'
    ,'text/xml');
doc.documentElement.setAttribute('x','y');
doc.documentElement.setAttributeNS('./lite','c:x','y2');
var nsAttr = doc.documentElement.getAttributeNS('./lite','x')
console.info(nsAttr)
console.info(doc)
// output the document as an XML string
console.info( doc.documentElement.toString() )
Something went wrong with that request. Please try again.