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 need to 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.
var xmlDoc, xslDoc; // somehow will these with data var params = [ ["myNS","myparam1","myvalue1"], ["myNS","myparam2","myvalue2"] ] var result = OAT.Xml.transformXSLT(xmlDoc, xslDoc, params);
Returns a text value of node. So, for this markup:
<tag>content</tag>
The textValue of tag is content.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 #text nodes 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 a XML document (in string form) and removes default namespace. This is useful when we want to use XPath queries against such document, since these cannot be executed agains documents with default namespaces. Returns XML string.
Runs a xpath query against xmlDoc. Namespaces are resolved as properties of nsObject. Example:
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