|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectca.infoway.messagebuilder.util.xml.NodeUtil
public class NodeUtil
A variety of utility methods for manipulating nodes.
Constructor Summary | |
---|---|
NodeUtil()
|
Method Summary | |
---|---|
static List<Node> |
asList(NodeList children)
Treat the NodeList as a standard list. |
static List<Node> |
getChildNodes(Node node,
String tagName)
Get all children of a particular tag name as a list. |
static String |
getLocalOrTagName(Node node)
Get the local or tag name (depending on whether or not the DOM tree was parsed with namespace awareness. |
static String |
getTextValue(Node node)
Scan all immediate children of a node, and append all text nodes into a string. |
static String |
getTextValue(Node node,
boolean recurse)
Scan all immediate children of a node, and append all text nodes into a string. |
static List<Element> |
toElementList(Node node)
Get all child elements of the given node as a list of elements. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NodeUtil()
Method Detail |
---|
public static String getTextValue(Node node)
Scan all immediate children of a node, and append all text nodes into a string. Consider the following example:
<customer>Joe Schmoe</customer>
In this case, calling this method on the
customer
element returns "Joe Schmoe".
node
- - the node to scan
public static String getTextValue(Node node, boolean recurse)
Scan all immediate children of a node, and append all text nodes into a string. Consider the following example:
<customer>Joe Schmoe</customer>
In this case, calling this method on the
customer
element returns "Joe Schmoe".
node
- - the node to scanrecurse
- - a flag to indicate whether or not to recurse into
sub-elements
public static List<Node> asList(NodeList children)
Treat the NodeList as a standard list.
children
- - the node list
public static List<Node> getChildNodes(Node node, String tagName)
Get all children of a particular tag name as a list.
node
- - the parent nodetagName
- - the tag name to select
public static List<Element> toElementList(Node node)
Get all child elements of the given node as a list of elements.
node
- - the node
public static String getLocalOrTagName(Node node)
Get the local or tag name (depending on whether or not the DOM tree was parsed with namespace awareness.
node
- - the node/element
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |