public class XPathOperation extends PooledTransformerOperation<org.mule.module.xml.internal.operation.XPathOperation.XPathKey,XPathEvaluator> implements org.mule.runtime.api.lifecycle.Initialisable
documentBuilderFactory, entityResolver, expandEntities| Constructor and Description |
|---|
XPathOperation() |
XPathOperation(EntityExpansion expandEntities) |
| Modifier and Type | Method and Description |
|---|---|
protected org.apache.commons.pool2.BasePooledObjectFactory<XPathEvaluator> |
createPooledObjectFactory(org.mule.module.xml.internal.operation.XPathOperation.XPathKey key) |
List<String> |
xpathExtract(InputStream content,
String xpath,
Map<String,Object> contextProperties,
List<NamespaceMapping> namespaces,
NamespaceDirectory namespaceDirectory,
XmlModule config,
boolean addTrailingNewlines)
Evaluates an XPath expression the input content and returns the result.
|
doInitialise, initialise, start, stop, testOnReturn, withTransformerpublic XPathOperation()
public XPathOperation(EntityExpansion expandEntities)
@Execution(value=CPU_INTENSIVE) @Throws(value=XPathErrorTypeProvider.class) public List<String> xpathExtract(@Content(primary=true) InputStream content, String xpath, @Optional @Content @NullSafe Map<String,Object> contextProperties, @Optional @NullSafe List<NamespaceMapping> namespaces, @Optional @ParameterDsl(allowInlineDefinition=false) NamespaceDirectory namespaceDirectory, @Config XmlModule config, @Optional(defaultValue="false") boolean addTrailingNewlines)
Because XPath expressions can match any number of individual elements, this operation returns a List of Strings. If no element matched the expression, an empty list will be returned.
XPath expressions are also namespace aware, which is why this operation allows setting namespace mappings. These mappings will be merged with those optionally defined in the referenced namespace-directory, meaning that the evaluation will combine both sets of namespace mappings.
content - the XML content on which the XPath is evaluatedxpath - the XPath scriptcontextProperties - Properties that wil be made available to the transform context.namespaces - namespace mappings that will be used in this evaluation. They will be combined with the ones in the config
elementnamespaceDirectory - the namespace directory from which take base namespace mappingsconfig - the configaddTrailingNewlines - adds a newline character (\n) at the end of every xml-part resultprotected org.apache.commons.pool2.BasePooledObjectFactory<XPathEvaluator> createPooledObjectFactory(org.mule.module.xml.internal.operation.XPathOperation.XPathKey key)
createPooledObjectFactory in class PooledTransformerOperation<org.mule.module.xml.internal.operation.XPathOperation.XPathKey,XPathEvaluator>Copyright © 2026 MuleSoft, Inc.. All rights reserved.