org.openeai.xml
Class XmlElementLocator

java.lang.Object
  extended by org.openeai.OpenEaiObject
      extended by org.openeai.xml.XmlElementLocator

public class XmlElementLocator
extends OpenEaiObject

An XmlElementLocator class. Contains helper methods to find elements within an Xml document.

Version:
3.0 - 28 January 2003
Author:
Tod Jackson (tod@openeai.org), Steve Wheat (steve@openeai.org)

Field Summary
 
Fields inherited from class org.openeai.OpenEaiObject
logger
 
Constructor Summary
XmlElementLocator()
          Constructor
 
Method Summary
 org.jdom.Element getElementByAttributeNameValue(org.jdom.Element e, java.lang.String attrName, java.lang.String attrValue)
          Convenience method that searches for and returns an Element that has a child Attribute of "attrName" with a value of "attrValue".
 org.jdom.Element getElementByAttributeNameValueRecursive(org.jdom.Element e, java.lang.String attrName, java.lang.String attrValue)
          Convenience method that searches for and returns an Element that has a child Attribute of "attrName" with a value of "attrValue".
 org.jdom.Element getElementByAttributeValue(org.jdom.Element e, java.lang.String attrValue)
          Convenience method that searches for and returns an Element that has any child Attributes with a value of "attrValue".
 org.jdom.Element getElementByName(org.jdom.Element e, java.lang.String name)
          Convenience method that searches for and returns an Element that has a child Element with a name that matches the name passed in.
 org.jdom.Element getElementByNameValue(org.jdom.Element e, java.lang.String name, java.lang.String value)
          Convenience method that searches for and returns an Element that has a child Element of "name" with a value of "value".
 org.jdom.Element getElementByValue(org.jdom.Element e, java.lang.String value)
          Convenience method that searches for and returns an Element that has a child Element with a value of "value".
 
Methods inherited from class org.openeai.OpenEaiObject
getAppName, getDebug, getFromAddr, getMailHost, getMailService, getProperties, getToAddr, initializeLog4j, initializeLog4j, initializeLog4j, setAppName, setDebug, setFromAddr, setMailHost, setMailService, setProperties, setToAddr
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlElementLocator

public XmlElementLocator()
Constructor

Method Detail

getElementByAttributeNameValue

public final org.jdom.Element getElementByAttributeNameValue(org.jdom.Element e,
                                                             java.lang.String attrName,
                                                             java.lang.String attrValue)
Convenience method that searches for and returns an Element that has a child Attribute of "attrName" with a value of "attrValue". If no Elements are found, returns null.

The search is NOT recursive meaning that it will NOT "drill" down into all child Elements of the starting element passed in.

Parameters:
e - Element the Element at which to start the search. This means the search will be start from this Element and continue until there are no more children within this Element.
attrName - String the name of the child Attribute that's being searched for.
attrValue - String the value that's expected to exist in that Attribute.
Returns:
Element the element that meets the criteria specified by the Attribute name and value passed in, null if no Elements are found

getElementByAttributeNameValueRecursive

public final org.jdom.Element getElementByAttributeNameValueRecursive(org.jdom.Element e,
                                                                      java.lang.String attrName,
                                                                      java.lang.String attrValue)
Convenience method that searches for and returns an Element that has a child Attribute of "attrName" with a value of "attrValue". The attribute value comparison IS case insensitive. If no Elements are found, returns null.

The search is recursive meaning that it will "drill" down into all child Elements of the starting element passed in.

Parameters:
e - Element the Element at which to start the search. This means the search will be start from this Element and continue until there are no more children within this Element.
attrName - String the name of the child Attribute that's being searched for.
attrValue - String the value that's expected to exist in that Attribute.
Returns:
Element the element that meets the criteria specified by the Attribute name and value passed in, null if no Elements are found

getElementByAttributeValue

public final org.jdom.Element getElementByAttributeValue(org.jdom.Element e,
                                                         java.lang.String attrValue)
Convenience method that searches for and returns an Element that has any child Attributes with a value of "attrValue". If no Elements are found, returns null.

The search is recursive meaning that it will "drill" down into all child Elements of the starting element passed in as well.

Parameters:
e - Element the Element at which to start the search. This means the search will be start from this Element and continue until there are no more children within this Element.
attrValue - String the value being searched for in any child Attribute of the Element passed in.
Returns:
Element the element that meets the criteria specified by the Attribute value passed in, null if no Elements are found

getElementByName

public final org.jdom.Element getElementByName(org.jdom.Element e,
                                               java.lang.String name)
Convenience method that searches for and returns an Element that has a child Element with a name that matches the name passed in. If no Elements are found, returns null.

The search is recursive meaning that it will "drill" down into all child Elements of the starting element passed in as well.

Parameters:
e - Element the Element at which to start the search. This means the search will be start from this Element and continue until there are no more children within this Element.
name - String the name of the child Element that's being searched for.
Returns:
Element the element that meets the criteria specified by the Element name passed in, null if no Elements are found

getElementByNameValue

public final org.jdom.Element getElementByNameValue(org.jdom.Element e,
                                                    java.lang.String name,
                                                    java.lang.String value)
Convenience method that searches for and returns an Element that has a child Element of "name" with a value of "value". If no Elements are found, returns null.

The search is recursive meaning that it will "drill" down into all child Elements of the starting element passed in as well.

Parameters:
e - Element the Element at which to start the search. This means the search will be start from this Element and continue until there are no more children within this Element.
name - String the name of the child Element that's being searched for.
value - String the value that's expected to exist in that Element.
Returns:
Element the element that meets the criteria specified by the Element name and value passed in, null if no Elements are found

getElementByValue

public final org.jdom.Element getElementByValue(org.jdom.Element e,
                                                java.lang.String value)
Convenience method that searches for and returns an Element that has a child Element with a value of "value". If no Elements are found, returns null.

The search is recursive meaning that it will "drill" down into all child Elements of the starting element passed in as well.

Parameters:
e - Element the Element at which to start the search. This means the search will be start from this Element and continue until there are no more children within this Element.
value - String the value that's expected to exist in any child Element.
Returns:
Element the element that meets the criteria specified by the Element value passed in, null if no Elements are found


Copyright © 2002,2003 OpenEAI Software Foundation