NextApp Echo2
v2.1.0

nextapp.echo2.app.util
Class DomUtil

java.lang.Object
  extended by nextapp.echo2.app.util.DomUtil

public class DomUtil
extends java.lang.Object

A utility class which provides methods for working with a W3C DOM.


Method Summary
static boolean getBooleanAttribute(org.w3c.dom.Element element, java.lang.String attributeName)
          Determines whether a specific boolean flag is set on an element.
static org.w3c.dom.Element getChildElementByTagName(org.w3c.dom.Element parentElement, java.lang.String name)
          Retrieves the first immediate child element of the specified element whose name matches the provided name parameter.
static org.w3c.dom.Element getChildElementByTagNameNS(org.w3c.dom.Element parentElement, java.lang.String namespaceURI, java.lang.String localName)
          Retrieves the first immediate child element of the specified element whose name matches the provided name parameter.
static int getChildElementCountByTagName(org.w3c.dom.Element parentElement, java.lang.String name)
          Counts the number of immediate child elements of the specified element whose names match the provided name parameter.
static int getChildElementCountByTagNameNS(org.w3c.dom.Element parentElement, java.lang.String namespaceURI, java.lang.String localName)
          Counts the number of immediate child elements of the specified element whose names match the provided name parameter.
static org.w3c.dom.Element[] getChildElementsByTagName(org.w3c.dom.Element parentElement, java.lang.String name)
          Retrieves all immediate child elements of the specified element whose names match the provided name parameter.
static org.w3c.dom.Element[] getChildElementsByTagNameNS(org.w3c.dom.Element parentElement, java.lang.String namespaceURI, java.lang.String localName)
          Retrieves all immediate child elements of the specified element whose names match the provided name parameter.
static java.lang.String getElementText(org.w3c.dom.Element element)
          Returns the text content of a DOM Element.
static void setElementText(org.w3c.dom.Element element, java.lang.String value)
          Sets the text content of a DOM Element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getBooleanAttribute

public static boolean getBooleanAttribute(org.w3c.dom.Element element,
                                          java.lang.String attributeName)
Determines whether a specific boolean flag is set on an element.

Parameters:
element - The element to analyze.
attributeName - The name of the boolean 'flag' attribute.
Returns:
True if the value of the attribute is 'true', false if it is not or if the attribute does not exist.

getChildElementByTagName

public static org.w3c.dom.Element getChildElementByTagName(org.w3c.dom.Element parentElement,
                                                           java.lang.String name)
Retrieves the first immediate child element of the specified element whose name matches the provided name parameter.

Parameters:
parentElement - The element to search.
name - The name of the child element.
Returns:
The child element, or null if none was found.

getChildElementByTagNameNS

public static org.w3c.dom.Element getChildElementByTagNameNS(org.w3c.dom.Element parentElement,
                                                             java.lang.String namespaceURI,
                                                             java.lang.String localName)
Retrieves the first immediate child element of the specified element whose name matches the provided name parameter.

Parameters:
parentElement - The element to search.
namespaceURI - The namespace URI of the child element.
localName - The name of the child element.
Returns:
The child element, or null if none was found.

getChildElementsByTagName

public static org.w3c.dom.Element[] getChildElementsByTagName(org.w3c.dom.Element parentElement,
                                                              java.lang.String name)
Retrieves all immediate child elements of the specified element whose names match the provided name parameter.

Parameters:
parentElement - The element to search.
name - The name of the child element.
Returns:
An array of matching child elements.

getChildElementsByTagNameNS

public static org.w3c.dom.Element[] getChildElementsByTagNameNS(org.w3c.dom.Element parentElement,
                                                                java.lang.String namespaceURI,
                                                                java.lang.String localName)
Retrieves all immediate child elements of the specified element whose names match the provided name parameter.

Parameters:
parentElement - The element to search.
namespaceURI - The namespace URI of the child element.
localName - The name of the child element.
Returns:
An array of matching child elements.

getChildElementCountByTagName

public static int getChildElementCountByTagName(org.w3c.dom.Element parentElement,
                                                java.lang.String name)
Counts the number of immediate child elements of the specified element whose names match the provided name parameter.

Parameters:
parentElement - The element to analyze.
name - The name of the child element.
Returns:
The number of matching child elements.

getChildElementCountByTagNameNS

public static int getChildElementCountByTagNameNS(org.w3c.dom.Element parentElement,
                                                  java.lang.String namespaceURI,
                                                  java.lang.String localName)
Counts the number of immediate child elements of the specified element whose names match the provided name parameter.

Parameters:
parentElement - The element to analyze.
namespaceURI - The namespace URI of the child element.
localName - The name of the child element.
Returns:
The number of matching child elements.

getElementText

public static java.lang.String getElementText(org.w3c.dom.Element element)
Returns the text content of a DOM Element.

Parameters:
element - The Element to analyze.

setElementText

public static void setElementText(org.w3c.dom.Element element,
                                  java.lang.String value)
Sets the text content of a DOM Element.

Parameters:
element - The Element to modify.
value - The new text value.

NextApp Echo2
v2.1.0