public class XPathHelper extends Object
| Constructor and Description |
|---|
XPathHelper() |
XPathHelper(Document document) |
XPathHelper(Document document,
boolean cloneAndNormalize) |
XPathHelper(String xmlText) |
| Modifier and Type | Method and Description |
|---|---|
String |
evaluate(String xpathExpressionKey)
Convenience method for evaluating xpath expressions that uses as default for its
NamespaceContext, the NamespaceResolver class |
String |
evaluate(String xpathExpressionKey,
NamespaceContext nsContext) |
Object |
evaluate(String xpathExpressionKey,
QName returnType)
Convenience method for evaluating xpaths that uses as default for its
NamespaceContext,
the NamespaceResolver class. |
Object |
evaluate(String xpathExpressionKey,
QName returnType,
NamespaceContext nsContext) |
Document |
getDocument()
Retrieve the XML document being worked on by this XPathHelper utility class.
|
static String |
print(Node n)
Prints a given node as a String.
|
static String |
print(Node n,
String encoding)
Prints a given node as a String
|
String |
print(String xmlDeclaration,
String indent) |
static String |
xmlToString(Node node)
Convert an XML Node to a string representation.
|
public XPathHelper()
public XPathHelper(Document document)
document - - To parsepublic XPathHelper(Document document, boolean cloneAndNormalize)
public XPathHelper(String xmlText)
xmlText - public static String print(Node n)
n - - the node to print as a Stringpublic static String print(Node n, String encoding)
n - - the node to print as a Stringencoding - - the character encoding to use for the returned Stringpublic static String xmlToString(Node node)
node - the XML node to be convertedpublic String evaluate(String xpathExpressionKey) throws XPathExpressionException
NamespaceContext, the NamespaceResolver classxpathExpressionKey - XPathExpressionExceptionpublic String evaluate(String xpathExpressionKey, NamespaceContext nsContext) throws XPathExpressionException
xpathExpressionKey - nsContext - XPathExpressionExceptionpublic Object evaluate(String xpathExpressionKey, QName returnType) throws XPathExpressionException
NamespaceContext,
the NamespaceResolver class. Allows you to also change the how the type is returned.xpathExpressionKey - returnType - XPathExpressionExceptionpublic Object evaluate(String xpathExpressionKey, QName returnType, NamespaceContext nsContext) throws XPathExpressionException
xpathExpressionKey - returnType - nsContext - XPathExpressionExceptionpublic String print(String xmlDeclaration, String indent)
xmlDeclaration - indent - public Document getDocument()
This work is licensed under a Creative Commons Attribution 4.0 International License.