Click or drag to resize

Telogis.GeoBase.XMLDoc

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
XMLDoc Class

A class that provides a wrapper around all of the basic required XML functionality to abstract the differences in implementations between web browsers.

Constructor
NameDescription
XMLDoc(param)

Arguments

  • param (XMLDoc) - An existing XMLDoc, or a string containing the XML data to initialize from, or a valid object containing XML data, or an object with a textContext or innerText property that can be treated as a string.

Functions
NameDescription
appendChild (XMLDoc child)

Attaches a child node described by an XMLDoc to the root node of the calling document.

Arguments
  • child (XMLDoc) - The XMLDoc describing the child-node to append.

Returns

XMLDoc - The result of the append operation, i.e. the calling XMLDoc.

doc ()

Finds the XML document that the calling object is handling.

Returns

Object - The XML document object.

encodeXML (String str)

Encodes a string for display in an XML (or, say, XHTML) context by replacing reserved characters with the appropriate escaped sequences.

Arguments
  • str (String) - The plain-text string to encode for XML compatibility.

Returns

String - The appropriately encoded equivalent of XMLDoc.encodeXML.str.

getAttribute (String attr)

Finds the value of a certain attribute of the current XML node.

Arguments
  • attr (String) - The name of the attribute to get the value of.

Returns

String - The value of the attribute named by XMLDoc.getAttribute.attr on the root node of the document.

getTagName ()

Finds the tag name of the root element of the XMLDoc's document.

Returns

String - The XML object's root tag name.

parentNode ()

Finds the parent of the current XML node.

Returns

Object - The parent node of the caller.

removeNode (String xpath)

Searches for a single nodes given by an XPath expression in the XML document, and once it is found, removes it.

Arguments
  • xpath (String) - An XPath string descripting a path to remove the node at.

Returns

XMLDoc - The node that was removed, wrapped in an XMLDoc.

replaceNode (String path, XMLDoc newNode)

Searches for a single node given by an XPath expression in the XML document, and once it is found, replaces it with another.

Arguments
  • path (String) - An XPath string describing a path to replace the node at.

  • newNode (XMLDoc) - The DOM node to replace the result node of the search with, wrapped in an XMLDoc.

Returns

XMLDoc - The replacement node (XMLDoc.newNode, or null if the search did not return any results and no replacement was performed.

root ()

Finds the root DOM node of the calling XMLDoc wrapper. This will cause the XML text to be parsed if it has not been already.

Returns

Element - The root node of the XMLDoc's document.

selectNodes (String path)

Finds a collection of nodes in the XML document from an XPath string.

Arguments
  • path (String) - An XPath string describing a path to obtain the nodes from.

Returns

Array - The requested XML node collection, as an array of XMLDocs.

selectSingleNode (String path)

Finds a single node in the XML document from an XPath string.

Arguments
  • path (String) - An XPath string describing a path to obtain the node from.

Returns

XMLDoc - The requested XML node.

setAttribute (String attr, String value)

Sets the value of a certain attribute of the current XML node.

Arguments
  • attr (String) - The name of the attribute to set.

  • value (String) - The value to set XMLDoc.setAttribute.attr to.

Returns

XMLDoc - The result of the setAttribute operation, i.e. the calling XMLDoc.

text ()

Finds the XML string associated with the document represented by the object.

Returns

String - The string representation of the XML object.

transformXSL (String xslDoc, String args)

Applies an XSLT stylesheet to transform the XML document by creating and running an XSL processor.

Arguments
  • xslDoc (String) - An XSLT stylesheet used to control the transformation.

  • (Optional) args (String) - Any parameters to pass to the XSL processor. Defaults to null.

Returns

String - The text output of the transformation.