| java.lang.Object org.apache.tools.ant.taskdefs.optional.junit.DOMUtil
DOMUtil | final public class DOMUtil (Code) | | Some utilities that might be useful when manipulating DOM trees.
|
Inner Class :public interface NodeFilter | |
Inner Class :public static class NodeListImpl extends Vector implements NodeList | |
Method Summary | |
public 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.
Parameters: parent - the node to search child from. | public static String | getNodeAttribute(Node node, String name) return the attribute value of an element.
Parameters: node - the node to get the attribute from. Parameters: name - the name of the attribute we are looking for the value. | public static Node | importNode(Node parent, Node child) Simple tree walker that will clone recursively a node. | public static NodeList | listChildNodes(Node parent, NodeFilter filter, boolean recurse) list a set of node that match a specific filter. |
getChildByTagName | public static Element getChildByTagName(Node parent, String tagname)(Code) | | Iterate over the children of a given node and return the first node
that has a specific name.
Parameters: parent - the node to search child from. Can be null. Parameters: tagname - the child name we are looking for. Cannot be null. the first child that matches the given name or null ifthe parent is null or if a child does not match thegiven name. |
getNodeAttribute | public static String getNodeAttribute(Node node, String name)(Code) | | return the attribute value of an element.
Parameters: node - the node to get the attribute from. Parameters: name - the name of the attribute we are looking for the value. the value of the requested attribute or null if theattribute was not found or if node is not an Element. |
importNode | public static Node importNode(Node parent, Node child)(Code) | | Simple tree walker that will clone recursively a node. This is to
avoid using parser-specific API such as Sun's changeNodeOwner
when we are dealing with DOM L1 implementations since cloneNode(boolean)
will not change the owner document.
changeNodeOwner is much faster and avoid the costly cloning process.
importNode is in the DOM L2 interface.
Parameters: parent - the node parent to which we should do the import to. Parameters: child - the node to clone recursively. Its clone will beappended to parent. the cloned node that is appended to parent |
listChildNodes | public static NodeList listChildNodes(Node parent, NodeFilter filter, boolean recurse)(Code) | | list a set of node that match a specific filter. The list can be made
recursively or not.
Parameters: parent - the parent node to search from Parameters: filter - the filter that children should match. Parameters: recurse - true if you want the list to be made recursivelyotherwise false. the node list that matches the filter. |
|
|