public class DomElement extends Object
DomElement
wraps around an Element
and provides convenience methods.Constructor and Description |
---|
DomElement(Element elem)
Creates a new wrapper around the given
Element . |
Modifier and Type | Method and Description |
---|---|
String |
getAttribute(String name)
Returns the attribute value to a given attribute name or
null if the attribute doesn't exist. |
DomElement |
getChild(String name)
Returns the child element with the given name or
null if it doesn't exist. |
List<DomElement> |
getChildren() |
List<DomElement> |
getChildren(String name)
Returns all children of this element with the given tag name.
|
String |
getChildText(String name)
Returns the text content of a child node with the given name.
|
Element |
getElement() |
String |
getTagName()
Returns this element's tag name.
|
String |
getText() |
boolean |
hasAttribute(String name)
Tests if this element has an attribute with the specified name.
|
boolean |
hasChild(String name)
Checks if this element has a child element with the given name.
|
public DomElement(Element elem)
Element
.elem
- An w3c Elementpublic Element getElement()
public boolean hasAttribute(String name)
name
- Name of the attribute.true
if this element has an attribute with the specified name.public String getAttribute(String name)
null
if the attribute doesn't exist.name
- The attribute's namenull
public boolean hasChild(String name)
name
- The child's nametrue
if this element has a child element with the given namepublic DomElement getChild(String name)
null
if it doesn't exist.name
- The child's namenull
public String getChildText(String name)
null
is returned.name
- The child's namenull
public List<DomElement> getChildren()
public List<DomElement> getChildren(String name)
name
- The children's tag namepublic String getTagName()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses