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

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -