1
0
mirror of https://github.com/stolksdorf/homebrewery.git synced 2025-12-15 00:55:57 +00:00
Files
homebrewery/jsx.test.js
2016-04-06 00:45:57 -04:00

40 lines
599 B
JavaScript

require('app-module-path').addPath('./shared');
var jsx = require('xml2js').parseString;
var parser = require('xml2json');
var XMLMapping = require('xml-mapping');
var xml = `
<NewBlock woh="6" cant_be="neato">
<Weird href="cooool things" />
<span> hey! </span>
<span> me too! </span>
</NewBlock>
`
var json = XMLMapping.load(xml);
return console.log(JSON.stringify(json, null, ' '));
/*
return console.log(parser.toJson(xml, {
arrayNotation: true,reversible: true,
}));
*/
jsx(xml, {trim: true}, function (err, result) {
console.log(JSON.stringify(result, null, ' '));
});