mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-15 15:41:19 +00:00
27 lines
592 B
JavaScript
27 lines
592 B
JavaScript
var util = require('util');
|
|
var xml2js = require('xml2js');
|
|
|
|
var myxml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?> \
|
|
<Items> \
|
|
<Item> \
|
|
<id>1</id> \
|
|
<color>green</color> \
|
|
</Item> \
|
|
<Item> \
|
|
<id>2</id> \
|
|
<color>red</color> \
|
|
</Item> \
|
|
<Item> \
|
|
<id>3</id> \
|
|
<color>yellow</color> \
|
|
</Item> \
|
|
</Items>"
|
|
var myxml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
|
|
<empty />"
|
|
|
|
xml2js.parseString(myxml, function (e, r) {
|
|
console.log(util.inspect(r, false, null));
|
|
//console.log(new xml2js.Builder().buildObject(r));
|
|
});
|
|
|