public class SynapseXPath extends SynapsePath
XPath that has been used inside Synapse xpath processing. This has a extension function named
get-property
which is use to retrieve message context properties with the given
name from the function
For example the following function get-property('prop')
can be evaluatedd using
an XPath to retrieve the message context property value with the name prop
.
Apart from that this XPath has a certain set of XPath variables associated with it. They are as follows;
Also there are some XPath prefixes defined in SynapseXPath
to access various
properties using XPath variables, where the variable name represents the particular prefix and
the property name as the local part of the variable. Those variables are;
This XPath is Thread Safe, and provides a special set of evaluate functions for the
MessageContext
and SOAPEnvelope
as well as a method to retrieve
string values of the evaluated XPaths
AXIOMXPath
,
getContext(Object)
,
SynapseXPathFunctionContext
,
SynapseXPathVariableContext
,
Serialized FormbufferSizeSupport, contentAware, domNamespaceMap, expression, JSON_PATH, X_PATH
Constructor and Description |
---|
SynapseXPath(org.apache.axiom.om.OMAttribute attribute)
Construct an XPath expression from a given attribute.
|
SynapseXPath(org.apache.axiom.om.OMElement element,
java.lang.String xpathExpr)
Construct an XPath expression from a given string and initialize its
namespace context based on a given element.
|
SynapseXPath(java.lang.String xpathString)
Initializes the
SynapseXPath with the given xpathString as the
XPath |
SynapseXPath(java.lang.String xpathExpr,
org.apache.axiom.om.OMElement elem)
Evaluate if the expression is compilable in XPath 2.0 format.
|
Modifier and Type | Method and Description |
---|---|
void |
addNamespace(org.apache.axiom.om.OMNamespace ns) |
java.lang.Object |
evaluate(java.lang.Object primaryContext,
MessageContext secondaryContext)
Specialized form of xpath evaluation function.An xpath evaluate() will be performed using two contexts
(ie:-soap-envelope and on Synapse Message Context).
|
java.lang.String |
evaluateDOMXPath(MessageContext synCtx) |
protected org.jaxen.Context |
getContext(java.lang.Object obj)
Create a
Context wrapper for the provided object. |
java.lang.String |
getEvaluator() |
boolean |
isForceDisableStreamXpath() |
static SynapseXPath |
parseXPathString(java.lang.String xPathStr) |
void |
setEvaluator(java.lang.String evaluator) |
void |
setForceDisableStreamXpath(boolean forceDisableStreamXpath) |
java.lang.String |
stringValueOf(MessageContext synCtx)
Evaluates the XPath expression against the MessageContext of the current message and
returns a String representation of the result
|
addNamespacesForFallbackProcessing, getExpression, getMessageInputStreamPT, getPathType, handleException, isContentAware, isMessageBiggerThanBuffer, setExpression, setPathType, toString
addNamespace, addNamespaces, getNamespaces
booleanValueOf, createFunctionContext, createNamespaceContext, createVariableContext, debug, evaluate, getContextSupport, getFunctionContext, getNamespaceContext, getNavigator, getRootExpr, getVariableContext, numberValueOf, selectNodes, selectNodesForContext, selectSingleNode, selectSingleNodeForContext, setFunctionContext, setNamespaceContext, setVariableContext, stringValueOf, valueOf
public SynapseXPath(java.lang.String xpathString) throws org.jaxen.JaxenException
Initializes the SynapseXPath
with the given xpathString
as the
XPath
xpathString
- xpath in its string formatorg.jaxen.JaxenException
- in case of an initialization failurepublic SynapseXPath(java.lang.String xpathExpr, org.apache.axiom.om.OMElement elem) throws org.jaxen.JaxenException
xpathExpr
- XPath expressionelem
- Expression Configurationsorg.jaxen.JaxenException
- will be thrown if the expression is malformedpublic SynapseXPath(org.apache.axiom.om.OMElement element, java.lang.String xpathExpr) throws org.jaxen.JaxenException
element
- The element that determines the namespace context of the
XPath expression. See AXIOMXPath.addNamespaces(OMElement)
for more details.xpathExpr
- the string representation of the XPath expression.org.jaxen.JaxenException
- if there is a syntax error while parsing the expression
or if the namespace context could not be set uppublic SynapseXPath(org.apache.axiom.om.OMAttribute attribute) throws org.jaxen.JaxenException
attribute
- the attribute to construct the expression fromorg.jaxen.JaxenException
- if there is a syntax error while parsing the expression
or if the namespace context could not be set uppublic java.lang.String getEvaluator()
public void setEvaluator(java.lang.String evaluator)
public static SynapseXPath parseXPathString(java.lang.String xPathStr) throws org.jaxen.JaxenException
org.jaxen.JaxenException
public java.lang.String stringValueOf(MessageContext synCtx)
Evaluates the XPath expression against the MessageContext of the current message and returns a String representation of the result
stringValueOf
in class SynapsePath
synCtx
- the source message which holds the MessageContext against full contextpublic java.lang.Object evaluate(java.lang.Object primaryContext, MessageContext secondaryContext)
primaryContext
- a context object ie:- a soap envelopesecondaryContext
- a context object ie:-synapse message ctxtpublic void addNamespace(org.apache.axiom.om.OMNamespace ns) throws org.jaxen.JaxenException
org.jaxen.JaxenException
protected org.jaxen.Context getContext(java.lang.Object obj)
Context
wrapper for the provided object.
This methods implements the following class specific behavior:
MessageContext
SynapseXPathFunctionContext
and
SynapseXPathVariableContext
are
available.SOAPEnvelope
SynapseXPathVariableContext
are available.BaseXPath.getContext(Object)
.
Note that the behavior described here also applies to all evaluation
methods such as BaseXPath.evaluate(Object)
or BaseXPath.selectSingleNode(Object)
,
given that these methods all use getContext(Object)
.
getContext
in class org.jaxen.BaseXPath
SynapseXPathFunctionContext.getFunction(String, String, String)
,
SynapseXPathVariableContext.getVariableValue(String, String, String)
public boolean isForceDisableStreamXpath()
public void setForceDisableStreamXpath(boolean forceDisableStreamXpath)
public java.lang.String evaluateDOMXPath(MessageContext synCtx) throws javax.xml.xpath.XPathExpressionException
javax.xml.xpath.XPathExpressionException
Copyright © 2005-2021 Apache Software Foundation. All Rights Reserved.