public class XPath3Function extends Object implements ExpressionLanguageFunction
XPathEvaluator
The function will now accept the following arguments (in order):
expression (required String) | The Xpath expression to be evaluated. Cannot be null or blank. |
input (optional Object, defaults to the message payload) | The input data on which the expression is going to be evaluated. This is an optional argument, it defaults to the message payload if not provided. |
Output type (optional String, defaults to ?STRING?) | When executing an XPath expression, a developer might have very different intents. Sometimes you want to retrieve actual data,
sometimes you just want to verify if a node exists. Also, the JAXP API (JSR-206) defines the standard way for a Java application to handle XML, and therefore,
how to execute XPath expressions. This API accounts for the different intents a developer might have and allows choosing from a list of possible output types.
We consider this to be a really useful features in JAXP, and we also consider that many Java developers that are familiar with this API would appreciate
that Mule accounts for this while hiding the rest of the API's complexity. That is why there's a third parameter (optional, String),
which will allow specifying one of the following:
|
byte[]
IllegalArgumentException
will be thrown.
This function will verify if the input is a consumable type (streams, readers, etc). Because evaluating the expression over a consumable input
will cause that source to be exhausted, in the cases in which the input value was the actual message payload
(no matter if it was given explicitly or by default), it will update the output message payload with the result obtained from consuming the input.public Object call(Object[] params, ExpressionLanguageContext context)
call
in interface ExpressionLanguageFunction
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.