Useful function for XML access and manipulation.
Parses a string of XML data and returns a document object.
Applies a XSLT template. xslDoc is a template to be applied to xmlDoc. Both arguments must be valid XML documents (not strings). The third (optional) argument is an array of XSLT parameters. Each parameter is a triple (array), which consists of Namespace, Name, and Value.
Returns a text value of node. So, for the markup below, the textValueof tag is content --
<tag>content</tag>
Returns node's local name - the part without namespace prefix.<xsl:template> has a localName template.
Returns all child nodes which are ordinary elements (i.e., no#textnodes, etc.).
Identical to getElementsByTagName, but looks only into non-namespace part of tag name.
Returns a value of attribute whose non-prefixed name is attributeName
Takes an XML document in string form and removes default namespace. This is useful when we want to use XPath queries against such a document, since these cannot be executed against documents with default namespaces. Returns XML string.
Runs an XPath query (xPathQuery) against xmlDoc. Namespaces are resolved as properties of nsObject.
Returns escaped.
Returns unescaped.
var xmlDoc, xslDoc; // somehow fill these with data var params = [ ["myNS","myparam1","myvalue1"], ["myNS","myparam2","myvalue2"] ] var result = OAT.Xml.transformXSLT(xmlDoc, xslDoc, params);
var xmlString = '<?xml version="1.0" ?><document><node>value</node><node /></document>'; var xmlDoc = OAT.Xml.createXmlDoc(xmlString); var nodeArray = OAT.Xml.xpath(xmlDoc, '//node', {}); alert(nodeArray.length); // 2