xmlconv

0.0.4 • Public • Published

xmlconv: XML conversion by convention

latest version published to npm

npm install xmlconv

Powered by libxmljs, see the libxmljs API documentation for help implementing other conventions.

Example

Convert a pretty simple document according to the Parker convention:

var xmlconv = require('xmlconv');
var xml = [
  '<?xml version="1.0" ?>',
  '<note>',
  '  <to>The W3C</to>',
  '  <from>Chris</from>',
  '  <subject>XML</subject>',
  '  <body>I just wish XML was drier.</body>',
  '</note>'
].join('\n');
var obj = xmlconv(xml, {convention: 'parker'});
console.log(JSON.stringify(obj, null, '  '));

This will print the following JSON output:

{
  "to": "The W3C",
  "from": "Chris",
  "subject": "XML",
  "body": "I just wish XML was drier."
}

Supported conventions

Convention Email example Media example
XML email media
parker email media
castle email media
boids email media
dom (not pure JSON)

TODO

Implement additional conventions:

Conventions

Testing

Continuous integration:

Travis CI Build Status

Running tests locally:

npm test

See node-tap documentation for the implications of the various testing verbs (e.g., equal vs. equivalent vs. similar).

License

Copyright © 2013 Christopher Brown. MIT Licensed.

Dependencies (2)

Dev Dependencies (1)

Package Sidebar

Install

npm i xmlconv

Weekly Downloads

3

Version

0.0.4

License

MIT

Unpacked Size

24.5 kB

Total Files

22

Last publish

Collaborators

  • chbrown