org.mule.module.xml.transformer
Class JXPathExtractor
java.lang.Object
org.mule.transformer.AbstractTransformer
org.mule.module.xml.transformer.JXPathExtractor
- All Implemented Interfaces:
- AnnotatedObject, MuleContextAware, Disposable, Initialisable, NameableObject, NamedObject, MessageProcessor, Transformer, EndpointAware
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 |
dispose, generateTransformerName, getAnnotation, getAnnotations, getEncoding, getEncoding, getEndpoint, getMimeType, getName, getReturnClass, getReturnDataType, getSourceDataTypes, getSourceTypes, isAcceptNull, isAllowNullReturn, isConsumed, isIgnoreBadInput, isSourceDataTypeSupported, isSourceDataTypeSupported, isSourceTypeSupported, isSourceTypeSupported, process, registerSourceType, registerSourceType, setAllowNullReturn, setAnnotations, setEncoding, setEndpoint, setIgnoreBadInput, setMimeType, setName, setReturnClass, setReturnDataType, toString, transform, transform, unregisterSourceType, unregisterSourceType |
OUTPUT_TYPE_NODE
public static final String OUTPUT_TYPE_NODE
- See Also:
- Constant Field Values
OUTPUT_TYPE_XML
public static final String OUTPUT_TYPE_XML
- See Also:
- Constant Field Values
OUTPUT_TYPE_VALUE
public static final String OUTPUT_TYPE_VALUE
- See Also:
- Constant Field Values
JXPathExtractor
public JXPathExtractor()
setMuleContext
public void setMuleContext(MuleContext context)
- Specified by:
setMuleContext
in interface MuleContextAware
- Overrides:
setMuleContext
in class AbstractTransformer
initialise
public void initialise()
throws InitialisationException
- Template method where deriving classes can do any initialisation after the
properties have been set on this transformer
- Specified by:
initialise
in interface Initialisable
- Overrides:
initialise
in class AbstractTransformer
- Throws:
InitialisationException
RecoverableException
- if an error occurs that can be recovered from
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
getOutputType
public String getOutputType()
setOutputType
public void setOutputType(String outputEncoding)
getNamespaces
public Map<String,String> getNamespaces()
setNamespaces
public void setNamespaces(Map<String,String> namespaceURIs)
Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.