org.apache.tools.ant.taskdefs.optional.junit
public final class DOMUtil extends Object
Nested Class Summary | |
---|---|
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 Element | getChildByTagName(Node parent, String tagname)
Iterate over the children of a given node and return the first node
that has a specific name. |
static String | getNodeAttribute(Node node, String name)
return the attribute value of an element. |
static Node | importNode(Node parent, Node child)
Simple tree walker that will clone recursively a node. |
static NodeList | listChildNodes(Node parent, DOMUtil.NodeFilter filter, boolean recurse)
list a set of node that match a specific filter. |
Parameters: parent the node to search child from. Can be null. tagname the child name we are looking for. Cannot be null.
Returns: the first child that matches the given name or null if the parent is null or if a child does not match the given name.
Parameters: node the node to get the attribute from. name the name of the attribute we are looking for the value.
Returns: the value of the requested attribute or null if the attribute was not found or if node is not an Element.
Parameters: 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.
Returns: the cloned node that is appended to parent
Parameters: parent the parent node to search from filter the filter that children should match. recurse true if you want the list to be made recursively otherwise false.
Returns: the node list that matches the filter.