Array of Namespace
XML Module Reference - Mule 4
XML Module v1.2
The XML Module can process and extract data from an XML document. This module should be used for advanced use cases or use cases associated with XML standards such as XSLT, XPath, and XQuery or XSD. DataWeave is not only perfectly capable to handle most of those use cases and can replace those standards the majority of the times, but it’s also our recommended approach.
Release Notes: XML Module Release Notes
Configurations
Default Configuration
Default configuration
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Name |
String |
The name for this configuration. Connectors reference the configuration with this name. |
x |
|
Namespaces |
Allows to globally map prefixes to namespace URIs. On this version, the xpath-extract operation is the only one to consume these mappings |
|||
Expand Entities |
Enumeration, one of:
|
Defines how to treat entity expansion. Setting a value different than NEVER renders the application vulnerable to XXE and/or DoS attacks |
NEVER |
|
Expiration Policy |
Configures the minimum amount of time that a dynamic configuration instance can remain idle before the runtime considers it eligible for expiration. This does not mean that the platform expires the instance at the exact moment that it becomes eligible. The runtime actually purges the instances when it sees fit. |
Operations
Validate Schema
<xml-module:validate-schema>
Validates that the input content is compliant with a given schema. This operation supports referencing many schemas (using comma as a separator) which include each other.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
The name of the configuration to use. |
x |
|
Schemas |
String |
The path to the schema file. You can specify multiple schema locations by using a comma separator |
x |
|
Schema Language |
Enumeration, one of:
|
The schema language to use. |
W3C |
|
Content |
Binary |
the XML content to validate |
#[payload] |
|
Expand Entities |
Enumeration, one of:
|
Set to NEVER to prevent XXE and DoS attacks |
XPath Extract
<xml-module:xpath-extract>
Evaluates an XPath expression the input content and returns the result. <p> 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. <p> 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.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
The name of the configuration to use. |
x |
|
Content |
Binary |
the XML content on which the XPath is evaluated |
#[payload] |
|
Xpath |
String |
the XPath script |
x |
|
Context Properties |
Object |
Properties that will be made available to the transform context. |
||
Namespaces |
Array of Namespace |
namespace mappings that will be used in this evaluation. They will be combined with the ones in the config element |
||
Namespace Directory |
the namespace directory from which take base namespace mappings |
|||
Expand Entities |
Enumeration, one of:
|
Set to NEVER to prevent XXE and DoS attacks |
||
Target Variable |
String |
The name of a variable on which the operation’s output will be placed |
||
Target Value |
String |
An expression that will be evaluated against the operation’s output and the outcome of that expression will be stored in the target variable |
#[payload] |
XQuery Transform
<xml-module:xquery-transform>
Uses XQuery to transform the input content. You can set transformation context properties which will be made available on the XQuery execution
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
The name of the configuration to use. |
x |
|
Content |
Binary |
the XML content to transform |
#[payload] |
|
Xquery |
String |
The XQuery script definition |
x |
|
Context Properties |
Object |
Properties that will be made available to the transform context. |
||
Expand Entities |
Enumeration, one of:
|
Set to NEVER to prevent XXE and DoS attacks |
||
Target Variable |
String |
The name of a variable on which the operation’s output will be placed |
||
Target Value |
String |
An expression that will be evaluated against the operation’s output and the outcome of that expression will be stored in the target variable |
#[payload] |
XSLT Transform
<xml-module:xslt-transform>
Uses XSLT to transform the input content. You can set transformation context properties which will be made available on the stylesheet.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
The name of the configuration to use. |
x |
|
Content |
Binary |
the XML content to transform |
#[payload] |
|
Xslt |
String |
the XSLT script definition |
x |
|
Context Properties |
Object |
Properties that will be made available to the transform context. |
||
Expand Entities |
Enumeration, one of:
|
Set to NEVER to prevent XXE and DoS attacks |
||
Output Mime Type |
String |
The mime type of the payload that this operation outputs. |
||
Target Variable |
String |
The name of a variable on which the operation’s output will be placed |
||
Target Value |
String |
An expression that will be evaluated against the operation’s output and the outcome of that expression will be stored in the target variable |
#[payload] |
Types
Namespace
Field | Type | Description | Default Value | Required |
---|---|---|---|---|
Prefix |
String |
The prefix used in the XML document |
x |
|
Uri |
String |
The namespace URI |
x |
Expiration Policy
Field | Type | Description | Default Value | Required |
---|---|---|---|---|
Max Idle Time |
Number |
A scalar time value for the maximum amount of time a dynamic configuration instance should be allowed to be idle before it’s considered eligible for expiration |
||
Time Unit |
Enumeration, one of:
|
A time unit that qualifies the maxIdleTime attribute |
Namespace Directory
Field | Type | Description | Default Value | Required |
---|---|---|---|---|
Namespaces |
Array of Namespace |
Globally maps prefixes to namespace uris. On this version, the xpath-extract operation is the only one to consume these mappings |