You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ozgur Ozcitak edited this page Feb 18, 2019
·
3 revisions
XML builder implements parts of the DOM specification to allow running XPath queries against it. The DOM implementation does not currently support XML namespaces.
varbuilder=require('xmlbuilder');varxpath=require('xpath');vardoc=builder.create('book').ele('title').txt('The Book').doc();varnodes=xpath.select('//title',doc);// pass the XML document to XPathconsole.log(nodes[0].localName);// 'title'console.log(nodes[0].firstChild.data);// 'The Book'console.log(nodes[0].toString());// <title>The Book</title>