Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/mithunsatheesh/node-xml-compare
- Owner: mithunsatheesh
- Created: 2013-05-09T10:31:37.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-05-17T12:25:48.000Z (over 11 years ago)
- Last Synced: 2024-04-15T03:09:30.668Z (8 months ago)
- Language: JavaScript
- Size: 205 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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});
```