public final class DOMUtil extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
DOMUtil.NodeFilter
Filter interface to be applied when iterating over a DOM tree.
|
static class |
DOMUtil.NodeListImpl
custom implementation of a nodelist.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public static NodeList listChildNodes(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 String getNodeAttribute(Node node, String name)
node
- the node to get the attribute from.name
- the name of the attribute we are looking for the value.public static Element getChildByTagName(Node parent, 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 Node importNode(Node parent, 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.Copyright (c) 2014-2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries