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:
39
jsx.test.js
Normal file
39
jsx.test.js
Normal 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, ' '));
|
||||
});
|
||||
Reference in New Issue
Block a user