jstransformer-xml2js

1.0.0 • Public • Published

jstransformer-xml2js

xml2js support for JSTransformers.

Build Status Coverage Status Dependency Status NPM version

Installation

npm install jstransformer-xml2js

API

var xml = require('jstransformer')(require('jstransformer-xml'));
var opts = {};
 
var fixture = '<?xml version="1.0" encoding="UTF-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title>Example Feed</title></feed>';
 
var promise = xml.renderAsync(fixture, opts);
promise.then(function(data) {
  console.log(JSON.parse(data.body));
  //=> { feed:
  // { '$': { xmlns: 'http://www.w3.org/2005/Atom' },
  //   title: [ 'Example Feed' ] } }
});
 
var promise = xml.renderFileAsync('./path/to/config.xml', opts);
promise.then(function(data) {
  console.log(JSON.parse(data.body));
  //=> { feed:
  // { '$': { xmlns: 'http://www.w3.org/2005/Atom' },
  //   title: [ 'Example Feed' ] } }
});

License

MIT

Dependencies (3)

Dev Dependencies (1)

Package Sidebar

Install

npm i jstransformer-xml2js

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • stoeffel
  • schtoeffel
  • hemanth
  • timothygu
  • calebeby
  • vanchoy
  • tunnckocore