gov.lanl.Utility.xml
Class DomUtils

java.lang.Object
  |
  +--gov.lanl.Utility.xml.DomUtils
All Implemented Interfaces:
java.io.Serializable

public class DomUtils
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form
 

Constructor Summary
DomUtils()
          Creates new DomUtils
 
Method Summary
 org.w3c.dom.Element[] getAllChildrenWithAttribute(org.w3c.dom.Element root, java.lang.String elementname, java.lang.String attribname, java.lang.String attribval)
          returns all nodes of root with elementname having matching attribute and value
 org.w3c.dom.Element[] getAllChildrenWithAttributeName(org.w3c.dom.Element root, java.lang.String elementname, java.lang.String attribname)
          returns all nodes of root with elementname having matching attributename
 org.w3c.dom.Element[] getAllElementsWithAttribute(java.lang.String elementname, java.lang.String attribname, java.lang.String attribval)
          returns all nodes with elementname having matching attribute and value
 org.w3c.dom.Element[] getAllElementsWithAttributeName(java.lang.String elementname, java.lang.String attribname)
          returns all nodes with elementname having matching attributenam
static org.w3c.dom.Element getChildName(org.w3c.dom.Element parentNode, java.lang.String childname)
          return the first element of child of parent node
static org.w3c.dom.Element[] getChildrenNamed(org.w3c.dom.Element parentNode, java.lang.String childName)
          Get a list of Elements that are children of the parent and with the given name
static org.w3c.dom.Element getChildWithAttribute(org.w3c.dom.Element parentNode, java.lang.String childname, java.lang.String attribname, java.lang.String attribval)
          get the element that is a child of parentNode
 org.w3c.dom.Element getElementWithAttribute(java.lang.String elementname, java.lang.String attribname, java.lang.String attribval)
          returns first element on preorder traversal with matching attribname and value
 org.w3c.dom.Element getRootElement()
           
 void setdomTree(org.w3c.dom.Document domtree)
           
 java.lang.String toString()
          Serialize Content to String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DomUtils

public DomUtils()
Creates new DomUtils

Method Detail

setdomTree

public void setdomTree(org.w3c.dom.Document domtree)

getRootElement

public org.w3c.dom.Element getRootElement()

getElementWithAttribute

public org.w3c.dom.Element getElementWithAttribute(java.lang.String elementname,
                                                   java.lang.String attribname,
                                                   java.lang.String attribval)
returns first element on preorder traversal with matching attribname and value

Parameters:
elementname - containing the attribname
attribname - attribute to be selected
attribval - attributevalue to be matched
Returns:
Element

getChildWithAttribute

public static org.w3c.dom.Element getChildWithAttribute(org.w3c.dom.Element parentNode,
                                                        java.lang.String childname,
                                                        java.lang.String attribname,
                                                        java.lang.String attribval)
get the element that is a child of parentNode

Parameters:
parentNode - containing the child
childname - name of element to be looked up
attribname - name af attribute to be matched
attribval - value of attribue to be matched
Returns:
Element

getChildName

public static org.w3c.dom.Element getChildName(org.w3c.dom.Element parentNode,
                                               java.lang.String childname)
return the first element of child of parent node

Parameters:
parentNode -
childname -
Returns:
Element

getChildrenNamed

public static org.w3c.dom.Element[] getChildrenNamed(org.w3c.dom.Element parentNode,
                                                     java.lang.String childName)
Get a list of Elements that are children of the parent and with the given name

Parameters:
parentNode -
childName -
Returns:

getAllElementsWithAttribute

public org.w3c.dom.Element[] getAllElementsWithAttribute(java.lang.String elementname,
                                                         java.lang.String attribname,
                                                         java.lang.String attribval)
returns all nodes with elementname having matching attribute and value

Parameters:
elementname -
attribname -
attribval -
Returns:

getAllChildrenWithAttribute

public org.w3c.dom.Element[] getAllChildrenWithAttribute(org.w3c.dom.Element root,
                                                         java.lang.String elementname,
                                                         java.lang.String attribname,
                                                         java.lang.String attribval)
returns all nodes of root with elementname having matching attribute and value

Parameters:
root -
elementname -
attribname -
attribval -
Returns:

getAllChildrenWithAttributeName

public org.w3c.dom.Element[] getAllChildrenWithAttributeName(org.w3c.dom.Element root,
                                                             java.lang.String elementname,
                                                             java.lang.String attribname)
returns all nodes of root with elementname having matching attributename

Parameters:
root -
elementname -
attribname -
Returns:

getAllElementsWithAttributeName

public org.w3c.dom.Element[] getAllElementsWithAttributeName(java.lang.String elementname,
                                                             java.lang.String attribname)
returns all nodes with elementname having matching attributenam

Parameters:
elementname -
attribname -
Returns:

toString

public java.lang.String toString()
Serialize Content to String

Overrides:
toString in class java.lang.Object