public final class XMLUtil
extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
private |
XMLUtil()
Prevent instances of this utility class.
|
| Modifier and Type | Method and Description |
|---|---|
static java.util.List<org.w3c.dom.Element> |
elementListByXPath(org.w3c.dom.Node node,
java.lang.String xpath)
Fetches a
List of Element from the supplied Node using the given xPath. |
static int |
getIntegerContent(org.w3c.dom.Document doc,
java.lang.String xpath)
Fetches value as integer from the supplied
Document using the given xPath. |
static org.w3c.dom.Node |
getRoot(org.w3c.dom.Document doc)
Fetches the root node from the given
Document and returns it. |
static java.lang.String |
getTextContent(org.w3c.dom.Document doc,
java.lang.String xpath)
Fetches text value as
String from the supplied Document using the given xPath. |
static org.w3c.dom.Document |
loadDocument(java.lang.String path)
Loads an XML document from the file the supplied path refers to.
|
static java.util.List<org.w3c.dom.Node> |
nodeListByXPath(org.w3c.dom.Document doc,
java.lang.String xpath)
Fetches a
List of Node from the supplied Document using the given xPath. |
static java.util.List<org.w3c.dom.Node> |
nodeListByXPath(org.w3c.dom.Node node,
java.lang.String xpath)
Fetches a
List of Node from the supplied Node using the given xPath. |
public static org.w3c.dom.Document loadDocument(java.lang.String path)
path - The path referred to the file which existence shall be read as XML document.Document representing the XML files content, otherwise null.public static java.util.List<org.w3c.dom.Node> nodeListByXPath(org.w3c.dom.Document doc,
java.lang.String xpath)
List of Node from the supplied Document using the given xPath.doc - The XML document as Document.xpath - The xPath expression as String.List of Node.public static java.util.List<org.w3c.dom.Node> nodeListByXPath(org.w3c.dom.Node node,
java.lang.String xpath)
List of Node from the supplied Node using the given xPath.node - The XML node as Node.xpath - The xPath expression as String.List of Node.public static java.util.List<org.w3c.dom.Element> elementListByXPath(org.w3c.dom.Node node,
java.lang.String xpath)
List of Element from the supplied Node using the given xPath.node - The XML node as Node.xpath - The xPath expression as String.List of Element.public static java.lang.String getTextContent(org.w3c.dom.Document doc,
java.lang.String xpath)
String from the supplied Document using the given xPath.doc - The XML document as Document.xpath - The xPath expression as String.String.public static int getIntegerContent(org.w3c.dom.Document doc,
java.lang.String xpath)
Document using the given xPath.doc - The XML document as Document.xpath - The xPath expression as String.public static org.w3c.dom.Node getRoot(org.w3c.dom.Document doc)
Document and returns it.doc - The XML document as Document.Node.