XML Module Reference | MuleSoft Documentation
# XML Module Reference
XML Module v1.4
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  
---|---|---|---|---  
The name for this configuration. Connectors reference the configuration with this name.  
Namespaces |  Array of Namespace | 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:
  * NEVER
  * INTERNAL

| Defines how to treat entity expansion. Setting a value different than NEVER renders the application vulnerable to XXE and/or DoS attacks  
Expiration Policy |  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
  *   * XQuery Transform
  * XSLT Transform


### 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.
To add your schema content, you only provide either schema or schema content, but not both. You can either upload your file in the **Schemas** field, or manually add the direct schema text content in the **Schema contents** field.   
---  
#### Parameters
Name | Type | Description | Default Value | Required  
---|---|---|---|---  
Configuration | The name of the configuration to use.  
The path to the schema file. You can specify multiple schema locations by using a comma separator  
Schema Contents |  Array of Schema Content | Schema text content for performing a schema validation.  
Schema Language |  Enumeration, one of:
  * RELAXNG

| The schema language to use.  
the XML content to validate | #[payload]  
Expand Entities |  Enumeration, one of:
  * NEVER
  * INTERNAL

| Set to NEVER to prevent XXE and DoS attacks  
#### For Configurations
Default Configuration
#### Throws
  * XML-MODULE:INVALID_INPUT_XML
  * XML-MODULE:INVALID_SCHEMA
  * XML-MODULE:SCHEMA_NOT_FOUND
  * XML-MODULE:SCHEMA_NOT_HONOURED
  * XML-MODULE:TRANSFORMATION
  * XML-MODULE:SCHEMA_INPUT_ERROR


### 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 | The name of the configuration to use.  
the XML content on which the XPath is evaluated | #[payload]  
the XPath script  
Context Properties | 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 |  Namespace Directory | the namespace directory from which take base namespace mappings  
Expand Entities |  Enumeration, one of:
  * NEVER
  * INTERNAL

| Set to NEVER to prevent XXE and DoS attacks  
Target Variable | The name of a variable on which the operation’s output will be placed  
Target Value | 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]  
#### Output
Array of String  
---  
#### For Configurations
Default Configuration
#### Throws
  * XML-MODULE:INVALID_INPUT_XML
  * XML-MODULE:INVALID_XPATH_EXPRESSION
  * XML-MODULE:NULL_CONTEXT_PROPERTY
  * XML-MODULE:TRANSFORMATION


### 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 | The name of the configuration to use.  
the XML content to transform | #[payload]  
The XQuery script definition  
Context Properties | Properties that will be made available to the transform context.  
Expand Entities |  Enumeration, one of:
  * NEVER
  * INTERNAL

| Set to NEVER to prevent XXE and DoS attacks  
Target Variable | The name of a variable on which the operation’s output will be placed  
Target Value | 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]  
#### Output
Array of String  
---  
#### For Configurations
Default Configuration
#### Throws
  * XML-MODULE:INVALID_INPUT_XML
  * XML-MODULE:NULL_CONTEXT_PROPERTY
  * XML-MODULE:TRANSFORMATION


### 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 | The name of the configuration to use.  
the XML content to transform | #[payload]  
the XSLT script definition  
Context Properties | Properties that will be made available to the transform context.  
Expand Entities |  Enumeration, one of:
  * NEVER
  * INTERNAL

| Set to NEVER to prevent XXE and DoS attacks  
Output Mime Type | The mime type of the payload that this operation outputs.  
Target Variable | The name of a variable on which the operation’s output will be placed  
Target Value | 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]  
#### For Configurations
Default Configuration
#### Throws
  * XML-MODULE:INVALID_INPUT_XML
  * XML-MODULE:NULL_CONTEXT_PROPERTY
  * XML-MODULE:TRANSFORMATION


## Types
### Namespace
Field | Type | Description | Default Value | Required  
---|---|---|---|---  
The prefix used in the XML document  
The namespace URI  
### Expiration Policy
Field | Type | Description | Default Value | Required  
---|---|---|---|---  
Max Idle Time | 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:
  * NANOSECONDS
  * MICROSECONDS
  * MILLISECONDS
  * SECONDS
  * MINUTES
  * HOURS

| A time unit that qualifies the maxIdleTime attribute  
### Schema Content
Field | Type | Description | Default Value | Required  
---|---|---|---|---  
Schema Name | Schema name content to define.  
Schema Text | Schema text content to define.  
### 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  
## See Also
MuleSoft Help Center