org.apache.beehive.netui.util.xml
Class DomUtils

Object
  extended by DomUtils

public final class DomUtils
extends Object

This class exists simply because DOM is so inconvenient to use.


Method Summary
static String getAttributeValue(Element element, String name)
          Retutns the value of the named attribute of the given element.
static Element getChildElementByName(Element parent, String name)
          Returns the first child element with the given name.
static List getChildElementsByName(Element parent, String name)
          Returns a list of child elements with the given name.
static String getChildElementText(Element parent, String name)
          Returns the text value of a child element.
static String[] getChildElementTextArr(Element parent, String name)
          Returns an array of text values of a child element.
static String getElementText(Element element)
          Returns the text value of a child element.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getChildElementByName

public static Element getChildElementByName(Element parent,
                                            String name)

Returns the first child element with the given name. Returns null if not found.

Parameters:
parent - parent element
name - name of the child element
Returns:
child element

getChildElementsByName

public static List getChildElementsByName(Element parent,
                                          String name)

Returns a list of child elements with the given name. Returns an empty list if there are no such child elements.

Parameters:
parent - parent element
name - name of the child element
Returns:
child elements

getChildElementText

public static String getChildElementText(Element parent,
                                         String name)

Returns the text value of a child element. Returns null if there is no child element found.

Parameters:
parent - parent element
name - name of the child element
Returns:
text value

getElementText

public static String getElementText(Element element)

Returns the text value of a child element. Returns null if there is no child element found.

Parameters:
element - element
Returns:
text value

getChildElementTextArr

public static String[] getChildElementTextArr(Element parent,
                                              String name)

Returns an array of text values of a child element. Returns null if there is no child element found.

Parameters:
parent - parent element
name - name of the child element
Returns:
text value

getAttributeValue

public static String getAttributeValue(Element element,
                                       String name)

Retutns the value of the named attribute of the given element. If there is no such attribute, returns null.

Parameters:
element - element
name - name
Returns:
value