|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tools.ant.taskdefs.optional.junit.DOMUtil
public final class DOMUtil
Some utilities that might be useful when manipulating DOM trees.
Nested Class Summary | |
---|---|
static interface |
DOMUtil.NodeFilter
Filter interface to be applied when iterating over a DOM tree. |
static class |
DOMUtil.NodeListImpl
custom implementation of a nodelist |
Method Summary | |
---|---|
static org.w3c.dom.Element |
getChildByTagName(org.w3c.dom.Node parent,
java.lang.String tagname)
Iterate over the children of a given node and return the first node that has a specific name. |
static java.lang.String |
getNodeAttribute(org.w3c.dom.Node node,
java.lang.String name)
return the attribute value of an element. |
static org.w3c.dom.Node |
importNode(org.w3c.dom.Node parent,
org.w3c.dom.Node child)
Simple tree walker that will clone recursively a node. |
static org.w3c.dom.NodeList |
listChildNodes(org.w3c.dom.Node parent,
DOMUtil.NodeFilter filter,
boolean recurse)
list a set of node that match a specific filter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static org.w3c.dom.NodeList listChildNodes(org.w3c.dom.Node parent, DOMUtil.NodeFilter filter, boolean recurse)
parent
- the parent node to search fromfilter
- the filter that children should match.recurse
- true if you want the list to be made recursively
otherwise false.
public static java.lang.String getNodeAttribute(org.w3c.dom.Node node, java.lang.String name)
node
- the node to get the attribute from.name
- the name of the attribute we are looking for the value.
public static org.w3c.dom.Element getChildByTagName(org.w3c.dom.Node parent, java.lang.String tagname)
parent
- the node to search child from. Can be null.tagname
- the child name we are looking for. Cannot be null.
public static org.w3c.dom.Node importNode(org.w3c.dom.Node parent, org.w3c.dom.Node child)
parent
- the node parent to which we should do the import to.child
- the node to clone recursively. Its clone will be
appended to parent.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |