Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mithunsatheesh/node-xml-compare

xml difference engine on node.js
https://github.com/mithunsatheesh/node-xml-compare

Last synced: 20 days ago
JSON representation

xml difference engine on node.js

Awesome Lists containing this project

README

        

#[node-xml-compare](http://mithunsatheesh.github.io/node-xml-compare)

xml compare is a node.js package to compare two xml strings.

##Description

xml compare is built on top of [sax-js](https://github.com/isaacs/sax-js/). It converts the input xml strings into json objects with the help of sax. Then It compares the json to calculate the difference between the parsed objects. The output is a json document with two attributes.

1. `-` : html encoded form of first xml string in which the nodes which are not in second xml are highlighted.
2. `+` : html encoded form of second xml string in which those additional nodes other than those in first are highlighted.

##Install

It can be installed via.

`npm install node-xml-compare`

##Usage

```javascript
var xmlcompare = require('node-xml-compare');

xml1 = '';
xml1 += '';
xml1 += '';
xml1 += 'Gambardella, Matthew';
xml1 += 'XML Developers Guide';
xml1 += 'Computer';
xml1 += '44.95';
xml1 += '2000-10-01';
xml1 += 'An in-depth look at creating applications with XML.';
xml1 += '';

xml2 = '';
xml2 += '';
xml2 += '';
xml2 += 'Some one else';
xml2 += 'XML Developers Guide';
xml2 += 'Computer';
xml2 += '440.95';
xml2 += '2000-10-01eee';
xml2 += '';

xmlcompare(xml1, xml2, function(result) {


//render result[-] to code blocks in html page to show the xml1 nodes that are not in xml2
//render result[+] to code blocks in html page to show the xml2 nodes that are not in xml1

});

```