public class XpathNodeIdentifier extends XmlSyntaxIdentifierImpl
This differs from the standard XpathSyntaxIdentifier
in that, rather than attempting to resolve your XPath to a text
value, it simply uses the XPath to try and resolve to a Node (or NodeList). This is more useful if you have an XML document that
doesn't contain any values for elements
If the DocumentBuilderFactoryBuilder
has been explicitly set to be not namespace aware and the document does in fact
contain namespaces, then Saxon can cause merry havoc in the sense that //NonNamespaceXpath
doesn't work if the document
has namespaces in it. We have included a shim so that behaviour can be toggled based on what you have configured.
Since 3.10.0 this class implements Condition
which means that it can be used as part of the conditional
services; if used in such a manner, then configuration is contextual, get/setDestination will be ignored (but may still have to
be configured due to validation
XPath.newXPathInstance(DocumentBuilderFactoryBuilder, NamespaceContext)
In the adapter configuration file this class is aliased as routing-xpath-node-syntax-identifier which is the preferred alternative to the fully qualified classname when building your configuration.
Constructor and Description |
---|
XpathNodeIdentifier() |
XpathNodeIdentifier(java.util.List<java.lang.String> xpaths,
java.lang.String dest) |
Modifier and Type | Method and Description |
---|---|
java.lang.Boolean |
getResolveAsNodeset() |
boolean |
isThisSyntax(java.lang.String message)
Determine if this SyntaxIdentifer considers the message to
match all the configured patterns.
|
protected boolean |
resolveAsNodeset() |
void |
setResolveAsNodeset(java.lang.Boolean b)
Specify whether to attempt to resolve the XPath as a Nodeset or as a single node.
|
createDocument, createXPath, getNamespaceContext, getXmlDocumentFactoryConfig, setNamespaceContext, setXmlDocumentFactoryConfig
addPattern, getPatterns, setPatterns
getDestination, setDestination
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
evaluate
close, init, start, stop
public XpathNodeIdentifier()
public XpathNodeIdentifier(java.util.List<java.lang.String> xpaths, java.lang.String dest)
public boolean isThisSyntax(java.lang.String message) throws ServiceException
SyntaxIdentifier
message
- the message to identify against.ServiceException
- if there was an error with the pattern.SyntaxIdentifier.isThisSyntax(java.lang.String)
public java.lang.Boolean getResolveAsNodeset()
public void setResolveAsNodeset(java.lang.Boolean b)
b
- true to attempt resolve as a Nodeset, default is false.XPathConstants.NODE
,
XPathConstants.NODESET
protected boolean resolveAsNodeset()