public class DomElement
extends java.lang.Object
DomElement wraps around an Element and provides convenience methods.| Constructor and Description |
|---|
DomElement(org.w3c.dom.Element elem)
Creates a new wrapper around the given
Element. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getAttribute(java.lang.String name)
Returns the attribute value to a given attribute name or
null if the attribute doesn't exist. |
DomElement |
getChild(java.lang.String name)
Returns the child element with the given name or
null if it doesn't exist. |
java.util.List<DomElement> |
getChildren() |
java.util.List<DomElement> |
getChildren(java.lang.String name)
Returns all children of this element with the given tag name.
|
java.lang.String |
getChildText(java.lang.String name)
Returns the text content of a child node with the given name.
|
org.w3c.dom.Element |
getElement() |
java.lang.String |
getTagName()
Returns this element's tag name.
|
java.lang.String |
getText() |
boolean |
hasAttribute(java.lang.String name)
Tests if this element has an attribute with the specified name.
|
boolean |
hasChild(java.lang.String name)
Checks if this element has a child element with the given name.
|
public DomElement(org.w3c.dom.Element elem)
Element.elem - An w3c Elementpublic org.w3c.dom.Element getElement()
public boolean hasAttribute(java.lang.String name)
name - Name of the attribute.true if this element has an attribute with the specified name.public java.lang.String getAttribute(java.lang.String name)
null if the attribute doesn't exist.name - The attribute's namenullpublic java.lang.String getText()
public boolean hasChild(java.lang.String name)
name - The child's nametrue if this element has a child element with the given namepublic DomElement getChild(java.lang.String name)
null if it doesn't exist.name - The child's namenullpublic java.lang.String getChildText(java.lang.String name)
null is returned.name - The child's namenullpublic java.util.List<DomElement> getChildren()
public java.util.List<DomElement> getChildren(java.lang.String name)
name - The children's tag namepublic java.lang.String getTagName()