You are here: Home » Saddle's components to enhance Mule » Export a Saddle Message as XML

Export a Saddle Message as XML

E-mail Print PDF

In some use cases, you have Saddle Messages, conforming to their templates, going through Mule. If you want to use them as XML instead (for example to run XPath queries or filtering on it), you just have to check the “Provide As XML” property on one of the following transformers:

  • DatabaseToMessage
  • MessageToDatabase
  • ExcelToMessage
  • MessageToExcel
  • MixedstringToMessage
  • MessageToMixedstring

 This will tell the transformer to return an XML representation of the message as a String instead of returning Field structure. 
Pay attention: the result is not the same as if you would use a MessageToMixedstring Transformer to transform a message that has been defined as XML to a String. Attributes will occur as XML attributes after the transformation, while they will just be another node if “Provide As XML” is checked.
Example: “field1” is defined with the field type “XML” and “attribute1” has been defined as being of type “attribute”
The output of “Provide as XML” would look like this:

<root>
    <field1>
        <attribute1>someValue</attribute1>
    </field1>
</root>

Whereas the output of a MessageToMixedstring transformer with a properly configured template would look like this:
<field1 attribute1=”someValue”/>