The input XML string
Optional parsing options
The parsed XML
const obj = parseXml(
`<root>
<child>text</child>
<ns:tag>content</ns:tag>
</root>`,
)
assert(obj.childNodes[0].nodeName === 'root')
assert(obj.childNodes[0].childNodes[0].nodeName === 'child')
assert(obj.childNodes[0].childNodes[0].childNodes[0].nodeValue === 'text')
assert(obj.childNodes[0].childNodes[1].nodeName === 'ns:tag')
assert(obj.childNodes[0].childNodes[1].prefix === 'ns')
assert(obj.childNodes[0].childNodes[1].localName === 'tag')
Parse XML into a JS object with no validation and some failure tolerance