How to get value from XML string with Node.js -
let's have xml:
<yyy:response xmlns:xxx='http://domain.com'> <yyy:success> <yyy:data>some-value</yyy:data> </yyy:success> </yyy:response>
how retrieve value in between <yyy:data>
using node.js?
thanks.
node-xml2js library you.
var xml2js = require('xml2js'); var parser = new xml2js.parser(); var xml = '\ <yyy:response xmlns:xxx="http://domain.com">\ <yyy:success>\ <yyy:data>some-value</yyy:data>\ </yyy:success>\ </yyy:response>'; parser.parsestring(xml, function (err, result) { console.dir(result['yyy:success']['yyy:data']); });
Comments
Post a Comment