public class XPath extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
MATCH
Represents a match type expression.
|
static double |
MATCH_SCORE_NODETEST
The match score if the pattern consists of just a NodeTest.
|
static double |
MATCH_SCORE_NONE
The match score if no match is made.
|
static double |
MATCH_SCORE_NSWILD
The match score if the pattern pattern has the form NCName:*.
|
static double |
MATCH_SCORE_OTHER
The match score if the pattern consists of something other than just a NodeTest or just a
qname.
|
static double |
MATCH_SCORE_QNAME
The match score if the pattern has the form of a QName optionally preceded by an @ character.
|
static int |
SELECT
Represents a select type expression.
|
| Constructor and Description |
|---|
XPath(Expression expr)
Construct an XPath object.
|
XPath(String exprString,
PrefixResolver prefixResolver,
int type)
Construct an XPath object.
|
XPath(String exprString,
PrefixResolver prefixResolver,
int type,
ErrorListener errorListener)
Construct an XPath object.
|
XPath(String exprString,
PrefixResolver prefixResolver,
int type,
ErrorListener errorListener,
FunctionTable aTable)
Construct an XPath object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
callVisitors(XPathVisitor visitor)
This will traverse the heararchy, calling the visitor for each member.
|
void |
error(XPathContext xctxt,
String msg,
Object[] args)
Tell the user of an error, and probably throw an exception.
|
XObject |
execute(XPathContext xctxt,
int contextNode,
PrefixResolver namespaceContext)
Given an expression and a context, evaluate the XPath and return the result.
|
XObject |
execute(XPathContext xctxt,
Node contextNode,
PrefixResolver namespaceContext)
Given an expression and a context, evaluate the XPath and return the result.
|
SourceLocator |
getLocator()
Get the SourceLocator on the expression object.
|
public static final int SELECT
public static final int MATCH
public static final double MATCH_SCORE_NONE
public static final double MATCH_SCORE_QNAME
public static final double MATCH_SCORE_NSWILD
public static final double MATCH_SCORE_NODETEST
public static final double MATCH_SCORE_OTHER
public XPath(String exprString, PrefixResolver prefixResolver, int type, ErrorListener errorListener) throws TransformerException
(Needs review -sc) This method initializes an XPathParser/ Compiler and compiles the expression.
exprString - The XPath expression.prefixResolver - A prefix resolver to use to resolve prefixes to namespace URIs.type - one of SELECT or MATCH.errorListener - The error listener, or null if default should be used.TransformerException - if syntax or other error.public XPath(String exprString, PrefixResolver prefixResolver, int type, ErrorListener errorListener, FunctionTable aTable) throws TransformerException
(Needs review -sc) This method initializes an XPathParser/ Compiler and compiles the expression.
exprString - The XPath expression.prefixResolver - A prefix resolver to use to resolve prefixes to namespace URIs.type - one of SELECT or MATCH.errorListener - The error listener, or null if default should be used.aTable - the function table to be usedTransformerException - if syntax or other error.public XPath(String exprString, PrefixResolver prefixResolver, int type) throws TransformerException
(Needs review -sc) This method initializes an XPathParser/ Compiler and compiles the expression.
exprString - The XPath expression.prefixResolver - A prefix resolver to use to resolve prefixes to namespace URIs.type - one of SELECT or MATCH.TransformerException - if syntax or other error.public XPath(Expression expr)
expr - The Expression object.public SourceLocator getLocator()
public XObject execute(XPathContext xctxt, Node contextNode, PrefixResolver namespaceContext) throws TransformerException
xctxt - The execution context.contextNode - The node that "." expresses.namespaceContext - The context in which namespaces in the XPath are supposed to be
expanded.TransformerException - thrown if the error condition is severe enough to halt processing.TransformerException - in case of errorpublic XObject execute(XPathContext xctxt, int contextNode, PrefixResolver namespaceContext) throws TransformerException
xctxt - The execution context.contextNode - The node that "." expresses.namespaceContext - The context in which namespaces in the XPath are supposed to be
expanded.TransformerException - thrown if the active ProblemListener decides the error condition
is severe enough to halt processing.TransformerException - in case of errorpublic void error(XPathContext xctxt, String msg, Object[] args) throws TransformerException
xctxt - The XPath runtime context.msg - An error msgkey that corresponds to one of the constants found in XPATHErrorResources, which is a key for a format
string.args - An array of arguments represented in the format string, which may be null.TransformerException - if the current ErrorListoner determines to throw an exception.public void callVisitors(XPathVisitor visitor)
visitor - The visitor whose appropriate method will be called.Copyright © 2022–2023. All rights reserved.