You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

28 lines
483 B

var xmldata =
'<test>' +
'<foo attr="123">' +
'Content &amp; stuff' +
'</foo>' +
'<foo attr="124">' +
'Second child' +
'</foo>' +
'<foo attr="125">' +
'Third child' +
'</foo>' +
'</test>';
print('=== input xml data')
print(xmldata);
print('=== parsing')
var doc = new XmlDocument(xmldata)
print(typeof doc);
print('=== pretty printed')
print(doc)
print('=== loop over "foo" children')
doc.eachChild(function (x) {
print(Duktape.enc('jsonx', x));
print(x);
});