How can I create an XML attribute using XPath to find the element I want to add the query on?
For example:
const xmlText = `<?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
<book>
<title lang="eng">Harry Potter</title>
<price>29.99</price>
</book>
<book>
<title id="somethingeng">Learning XML</title>
<price>39.95</price>
</book>
</bookstore>`;
var doc = new DOMParser().parseFromString(xmlText,'text/xml');
var r = doc.evaluate("//*[@lang[contains(.,'eng')]]", doc, null, XPathResult.ANY_TYPE, null);
I am looking to define an attribute for this 'r'.