Package org.apache.synapse.util.xpath
Class SourceXPathSupport
- java.lang.Object
-
- org.apache.synapse.util.xpath.SourceXPathSupport
-
public class SourceXPathSupport extends Object
Support class for mediators operating on message parts selected by an XPath expression. It handles the default XPath expressions11:Body/child::*[position()=1] | s12:Body/child::*[position()=1]
without actually parsing or evaluating it.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_XPATH
-
Constructor Summary
Constructors Constructor Description SourceXPathSupport()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SynapseXPath
getXPath()
Get the XPath expression.org.apache.axiom.om.OMNode
selectOMNode(MessageContext synCtx, SynapseLog synLog)
Get the first node selected by the configured XPath expression.void
setXPath(SynapseXPath xpath)
Set the XPath expression.void
setXPathString(String xpathString)
Set the string representation of the XPath expression.String
toString()
Get a string representation of the XPath expression for debugging purposes.
-
-
-
Field Detail
-
DEFAULT_XPATH
public static final String DEFAULT_XPATH
- See Also:
- Constant Field Values
-
-
Method Detail
-
getXPath
public SynapseXPath getXPath()
Get the XPath expression.- Returns:
- the XPath expression
-
setXPath
public void setXPath(SynapseXPath xpath)
Set the XPath expression.- Parameters:
xpath
- the XPath expression
-
setXPathString
public void setXPathString(String xpathString)
Set the string representation of the XPath expression. Note that this information is not mandatory and only used for debugging purposes. Setting the string representation explicitly may be useful to make sure that debugging messages contain the XPath expression in the exact form as specified by the user.- Parameters:
xpathString
- a string representation of the XPath expression
-
selectOMNode
public org.apache.axiom.om.OMNode selectOMNode(MessageContext synCtx, SynapseLog synLog)
Get the first node selected by the configured XPath expression. If no XPath expression is set, the first child element of the SOAP body is returned, i.e. in this case the method behaves as if the XPath expression iss11:Body/child::*[position()=1] | s12:Body/child::*[position()=1]
.- Parameters:
synCtx
- the message contextsynLog
-- Returns:
- the first node selected by the XPath expression
- Throws:
SynapseException
- if the evaluation of the XPath expression failed or didn't result in anOMNode
-
-