org.jscience.ml.tigerxml.tools
Class DomTools

java.lang.Object
  extended by org.jscience.ml.tigerxml.tools.DomTools

public class DomTools
extends java.lang.Object

Provides methods useful when utilizing the Document Object Model API as specified by the w3c. This class is for static use.


Constructor Summary
DomTools()
           
 
Method Summary
static void checkElementName(org.w3c.dom.Element ele, java.lang.String name)
          Checks if the name of ele is name.
static org.w3c.dom.Element getElement(org.w3c.dom.Element ele, java.lang.String name)
          Returns the first element named name in Element ele.
static java.lang.String getText(org.w3c.dom.Element ele)
          Returns the text embeded in ele.
static boolean hasElement(org.w3c.dom.Element ele, java.lang.String name)
          Checks if the given Element has a child named name.
static void printNodeInfo(org.w3c.dom.Node node)
          Prints information about a given node to stdout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomTools

public DomTools()
Method Detail

hasElement

public static final boolean hasElement(org.w3c.dom.Element ele,
                                       java.lang.String name)
Checks if the given Element has a child named name.

Parameters:
ele - The Element to be checked.
name - The name of the child to be checked.
Returns:
true if ele has a child name, else false.

getElement

public static final org.w3c.dom.Element getElement(org.w3c.dom.Element ele,
                                                   java.lang.String name)
Returns the first element named name in Element ele.

Parameters:
ele - The Element holding the element to be retrieved.
name - The name of the Element to be retrieved.
Returns:
The element to be retrieved.

printNodeInfo

public static final void printNodeInfo(org.w3c.dom.Node node)
Prints information about a given node to stdout.

Parameters:
node - The node to print information about.

checkElementName

public static final void checkElementName(org.w3c.dom.Element ele,
                                          java.lang.String name)
Checks if the name of ele is name. If not, a warning message is printed to stderr.

Parameters:
ele - The Element to be checked.
name - The name of the Element to be checked against.

getText

public static final java.lang.String getText(org.w3c.dom.Element ele)
Returns the text embeded in ele.

Parameters:
ele - The Element to be read out.
Returns:
The text embeded in ele.