de.fesenmeyer.dbnormalizer.core.configuration.xml
Class DOMUtil

java.lang.Object
  extended by de.fesenmeyer.dbnormalizer.core.configuration.xml.DOMUtil

public class DOMUtil
extends Object

Class providing utility methods for retrieving information from DOM-Documents.

Author:
DF

Constructor Summary
DOMUtil()
           
 
Method Summary
static Element getFirstChildElement(Element element, String name)
          Gets the first child of the element specified by argument element which has the tag name specified by argument name.
static Element getFirstElement(Element element, String name)
          Gets the first descendant of the element specified by argument element which has the tag name specified by argument name.
static String getSimpleElementText(Element element)
          Gets all child text nodes of an element as a single string.
static String getSimpleElementText(Element element, String name)
          Gets the text content of the first descendant of the element specified by argument element which has the tag name specified by argument name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMUtil

public DOMUtil()
Method Detail

getFirstElement

public static Element getFirstElement(Element element,
                                      String name)
Gets the first descendant of the element specified by argument element which has the tag name specified by argument name.

Parameters:
element - an element
name - a tag name
Returns:
the element, if one could be found; null, otherwise

getFirstChildElement

public static Element getFirstChildElement(Element element,
                                           String name)
Gets the first child of the element specified by argument element which has the tag name specified by argument name. Descendants other than children are ignored - in contrast to the getFirstElement(Element, String) method.

Parameters:
element - an element
name - a tag name
Returns:
the element, if one could be found; null, otherwise

getSimpleElementText

public static String getSimpleElementText(Element element,
                                          String name)
Gets the text content of the first descendant of the element specified by argument element which has the tag name specified by argument name.

Parameters:
element - an element
name - a tag name
Returns:
the text content as a string, if such an descendant could be found; null, otherwise

getSimpleElementText

public static String getSimpleElementText(Element element)
Gets all child text nodes of an element as a single string.

Parameters:
element - the element
Returns:
a string consisting of all the child text nodes