The following sample parses the XML string stored in the xmlString variable. The sample selects all config elements in the XML document node, loops through them, and append their contents.
/*
*@description function to convert xml to text
*/
function parseXmlContent() {
let xmlString = '<?xml version="1.0" encoding="UTF-8"?><config date="1465467658668" transient="false">Some content</config>';
let xmlDocument = xml.Parser.fromString({
text: xmlString
});
let bookNode = xml.XPath.select({
node: xmlDocument,
xpath: '//config'
});
let finalParsedContent=[];
for (let i = 0; i < bookNode.length; i++) {
finalParsedContent.push(bookNode[i])
}
}