Stole
Stole

Reputation: 5318

Validate XML Integrity in Mule

Occasionally an XML file is not transferred properly, and we end up with incomplete XML.

Ex.

<ORDER_STATUS>
<SALES_ORDER_STATUS>
    <ORDER_HEADER>
    </ORDER_HEADER>
</SALES_ORD

What would your suggestion be to catch these occurrences in a Mule flow?

Upvotes: 0

Views: 255

Answers (1)

aled
aled

Reputation: 25872

If you just want to validate the XML is valid you could just use a DataWeave expression to try to transform it:

<set-variable variableName="test" value="#[output application/java --- payload]" />

To read the XML DataWeave needs to validate it. You can enclose the set variable in a Try scope to handle the possible error if it is invalid.

In case that you have an XSD schema, or can write on, you could use the XML Module validation operation.

Upvotes: 1

Related Questions