ParseXML
From Svg wiki
Summary
parseXML() translates an XML string into a DOM document element.
Syntax
parseXML(string XML, document doc)
return value
XML document node
Example
var XML = "<foo>This is some text <tspan onclick=\"clickme()\">with a link</tspan></foo>";
var node = parseXML(XML, document);
var tspan = node.getElementsByTagName("tspan");
var onclick = tspan.getAttribute("clickme");
Notes
- If you have a document fragment (no root element), manually add a arbitrary root element and cycle over the child elements.
- Erroneous elements in the XML string are ignored (that is, they will be skipped).
- You have to give the document in which you want to use the node, otherwise a DOMException 4 will be thrown when you appendChild() the node.
