DOM Class

Provides basic utilities to simplify loading and parsing xml

Constructors

There are no public constructors.

Properties

ESCAPE_CHARS

Static Methods

createDocument( java.net.URL url ) returns Document
Used to create a DOM document from a URL.
createDocument( java.io.File file ) returns Document
Used to create a DOM document from a java.io.File. Returns null if the file cannot be serialized to XML.
createDocument( String xml ) returns Document
Used to create a DOM document from a String. Returns null if the string is invalid.
createDocument( String xml, String charsetName ) returns Document
createDocument( InputStream is ) returns Document
Used to create a DOM document from an InputStream.
getOuterNode( Document xml ) returns Node
Returns the outer node for a given xml document.
xmlA org.w3c.dom.Document
equals( Document xml, Document xml2 ) returns boolean
Used to compare two XML documents by performing a raw string comparison.
getText( Document xml ) returns String
Converts a DOM Document to a String
xmlA org.w3c.dom.Document
getText( NodeList nodeList ) returns String
Converts a NodeList to a String
getText( Node node ) returns String
Converts a Node to a String
hasChildren( Node node ) returns boolean
Used to determine whether a given node has any children. Differs from the native DOM implementation in that this function only considers child nodes that have a node type value equal to 1.
getAttributeValue( NamedNodeMap attrCollection, String attrName ) returns String
Used to return the value of a given node attribute. The search is case insensitive. If no match is found, returns an empty string.
getAttributeValue( Node node, String attrName ) returns String
Used to return the value of a given node attribute. The search is case insensitive. If no match is found, returns an empty string.
setAttributeValue( Node node, String attrName, String attrValue ) returns void
Used to create or update an attribute.
getNodeValue( Node node ) returns String
Returns the value of a given node as text. If the node has children, the method will return an xml fragment which will include the input node as the outer node. This is a legacy feature which should be deprecated over time.
getDocumentAttributes( Document xml ) returns NamedNodeMap
xmlA org.w3c.dom.Document
getTargetNameSpace( Document xml ) returns String
Returns the "targetNamespace" for a given xml document.
xmlA org.w3c.dom.Document
getNameSpaces( Document xml ) returns java.util.HashMap<String, String>
Returns a hashmap with all the namespaces found in a given xml document. The hashmap key is the namespace prefix and the corresponding value is the namespace url.
xmlA org.w3c.dom.Document
getElementsByTagName( String tagName, Document xml ) returns org.w3c.dom.Node[]
Returns an array of nodes that match a given tagName (node name). The results will include all nodes that match, regardless of namespace. To narrow the results to a specific namespace, simply include the namespace prefix in the tag name (e.g. "t:Contact").
getElementsByTagName( String tagName, Node node ) returns org.w3c.dom.Node[]
Returns an array of nodes that match a given tagName (node name). The results will include all nodes that match, regardless of namespace. To narrow the results to a specific namespace, simply include the namespace prefix in the tag name (e.g. "t:Contact"). Returns an empty array if no nodes are found.
getNodes( NodeList nodeList ) returns Node[]
Converts a NodeList into an array to simplify nested loops.
escapeXml( String content ) returns String
Used to encode text data for use in an XML tag or attribute.