public enum XmlUtil extends Enum<XmlUtil>
| Modifier and Type | Method and Description |
|---|---|
static String |
getCDATAorTextContent(Node node)
Returns the node's first CDATA section if the node has one.
|
static Element |
getElement(Node parent,
String tagName,
int index)
Returns the child element with the given tag name and index.
|
static List<Element> |
getElements(Node parent,
String tagName)
Returns all child elements with the given tag name.
|
static List<Element> |
getElementsFromNode(Element elem,
String nodeName,
String attributeName,
String attributeValue)
Returns a list of element's with the following criteria:
the node name must be equal to the given node name
the node must contain an attribute with the attribute name
the value of the attribute (with the given name) must be equal to the given value
|
static CDATASection |
getFirstCDataSection(Node node)
Returns the node's first CDATA section or
null if the node hasn't got one. |
static Element |
getFirstElement(Node parent)
Returns the first Element node
|
static Element |
getFirstElement(Node parent,
String tagName) |
static Text |
getTextNode(Node node)
Returns the node's text child node or
null if the node hasn't got a text node. |
static String |
getValueFromNode(Element elem,
String nodeName)
Returns the value of the first element with the given node name, starts searching by the
given Element
|
static XmlUtil |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static XmlUtil[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static XmlUtil[] values()
for (XmlUtil c : XmlUtil.values()) System.out.println(c);
public static XmlUtil valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic static final Element getFirstElement(Node parent)
public static final Element getElement(Node parent, String tagName, int index)
parent - The parent node.tagName - the element tag name.index - The 0 based position of the child.IndexOutOfBoundsException - if no element exists at the specified index.public static final List<Element> getElements(Node parent, String tagName)
Element.getElementsByTagName(String) to search all descendants.parent - The parent node.tagName - the element tag name.public static final Text getTextNode(Node node)
null if the node hasn't got a text node.public static final CDATASection getFirstCDataSection(Node node)
null if the node hasn't got one.public static final String getCDATAorTextContent(Node node)
null if the node hasn't got a text node.public static final String getValueFromNode(Element elem, String nodeName)
elem - The first element (root or parent) element the search beginsnodeName - The name searching forpublic static final List<Element> getElementsFromNode(Element elem, String nodeName, String attributeName, String attributeValue)
Copyright © 2017. All rights reserved.