AbstractXPathRuleQuery
, JaxenXPathRuleQuery
, SaxonXPathRuleQuery
public interface XPathRuleQuery
Implementations of this class do not need to be thread-safe, but they will be reused to query against different AST Nodes. Therefore, internal state should be maintained in a fashion consistent with reuse. Further, implementations are recommended to manage internal state that is invariant over AST Nodes in a fashion which facilities high performance (e.g. caching).
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
XPATH_1_0 |
XPath 1.0 version.
|
static java.lang.String |
XPATH_1_0_COMPATIBILITY |
XPath 1.0 compatibility version.
|
static java.lang.String |
XPATH_2_0 |
XPath 2.0 version.
|
Modifier and Type | Method | Description |
---|---|---|
java.util.List<Node> |
evaluate(Node node,
RuleContext data) |
Evaluate the XPath query against the given Node.
|
java.util.List<java.lang.String> |
getRuleChainVisits() |
Indicates which AST Nodes (if any) should be used with the RuleChain.
|
void |
setProperties(java.util.Map<PropertyDescriptor<?>,java.lang.Object> properties) |
Set the properties to use during the XPath query.
|
void |
setVersion(java.lang.String version) |
Set the XPath version to be used.
|
void |
setXPath(java.lang.String xpath) |
Set the XPath query string to be used.
|
static final java.lang.String XPATH_1_0
static final java.lang.String XPATH_1_0_COMPATIBILITY
static final java.lang.String XPATH_2_0
void setXPath(java.lang.String xpath)
xpath
- The XPath query string.void setVersion(java.lang.String version) throws java.lang.UnsupportedOperationException
version
- The XPath version.java.lang.UnsupportedOperationException
- if the version cannot be handled.void setProperties(java.util.Map<PropertyDescriptor<?>,java.lang.Object> properties)
java.util.List<java.lang.String> getRuleChainVisits()
java.util.List<Node> evaluate(Node node, RuleContext data)
node
- The Node.data
- The RuleContext.Copyright © 2002–2018 PMD. All rights reserved.