org.mule.module.xml.transformer
Class JXPathExtractor
java.lang.Object
org.mule.transformer.AbstractTransformer
org.mule.module.xml.transformer.JXPathExtractor
- All Implemented Interfaces:
- Initialisable, NamedObject, BaseTransformer, Transformer
public class JXPathExtractor
- extends AbstractTransformer
The JXPathExtractor is a simple transformer that evaluates an xpath expression
against the given bean and that returns the result.
By default, a single
result will be returned. If multiple values are expected, set the
singleResult
property to false
. In this case a
List
of values will be returned. Note the property is currently ignored
for non-String/XML payloads.
Methods inherited from class org.mule.transformer.AbstractTransformer |
checkReturnClass, generateTransformerName, getEndpoint, getName, getReturnClass, getSourceTypes, initialise, isAcceptNull, isConsumed, isIgnoreBadInput, isSourceTypeSupported, isSourceTypeSupported, registerSourceType, setEndpoint, setIgnoreBadInput, setName, setReturnClass, toString, transform, unregisterSourceType |
JXPathExtractor
public JXPathExtractor()
doTransform
public Object doTransform(Object src,
String encoding)
throws TransformerException
- Evaluate the expression in the context of the given object and returns the
result. If the given object is a string, it assumes it is an valid xml and
parses it before evaluating the xpath expression.
- Specified by:
doTransform
in class AbstractTransformer
- Throws:
TransformerException
getExpression
public String getExpression()
- Returns:
- Returns the expression.
setExpression
public void setExpression(String expression)
- Parameters:
expression
- The expression to set.
isSingleResult
public boolean isSingleResult()
- Should a single value be returned.
- Returns:
- value
setSingleResult
public void setSingleResult(boolean singleResult)
- If multiple results are expected from the
expression
evaluation, set
this to false.
- Parameters:
singleResult
- flag
Copyright © 2003-2008 MuleSource, Inc.. All Rights Reserved.