Giter Site home page Giter Site logo

node-xmlshim's Introduction

Node XML Shim

Build Status

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.

Branches:

  • 0.x: Compatible with node versions supported by jsdom 0.11.x
  • 1.x: Compatible with node versions supported by jsdom 3.x (0.10, 0.12)
  • 2.x: Compatible with node versions supported by jsdom >= 3.x (4, 6, 8)

Note that jsdom >= 1.0 does not support CDATA sections. Hence xmlshim >= 1.x will fail to parse/write any CDATA sections.

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.

node-xmlshim's People

Contributors

znerol avatar

Watchers

Josh Lloyd avatar James Cloos avatar Bryan Hoyt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.