1
0
mirror of https://github.com/stolksdorf/homebrewery.git synced 2026-01-02 13:29:15 +00:00

Starting work on the parser

This commit is contained in:
Scott Tolksdorf
2016-04-01 10:55:38 -04:00
parent 312167d96b
commit 536a768133
2 changed files with 289 additions and 0 deletions

39
jsx.test.js Normal file
View File

@@ -0,0 +1,39 @@
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, ' '));
});