Im a bit new to splitting XMLs, Can you help me create multiple XMLs from one input? do I need to use splitters? XSLT? also, can i plud in the message id in the xml as well?
Input
<?xml version="1.0"?>
<StockMovementDataRequest xmlns:p1="urn:ams.com.au:dynamo:3pl:am:SAP_AM_I_005:StockMovement" xmlns:a="http://www.edi.com.au/EnterpriseService">
<Header>
<From>Warehouse</From>
<To>Location</To>
<Unique_ID>idm1468201212</Unique_ID>
<DateTimeStamp>2016-04-13T11:55:30.263+10:00</DateTimeStamp>
</Header>
<StockMovementData>
<Serialised_Material>YES</Serialised_Material>
<DateTime>2016-04-13T11:55:30.263+10:00</DateTime>
<From_Location>30-80</From_Location>
<To_Location>client</To_Location>
<Material>7CAGL3G00</Material>
<Serial>700030011</Serial>
<Quantity>100</Quantity>
</StockMovementData>
<StockMovementData>
<Serialised_Material>YES</Serialised_Material>
<DateTime>2016-04-13T11:55:30.263+10:00</DateTime>
<From_Location>30-80</From_Location>
<To_Location>client</To_Location>
<Material>7CAGL3G00</Material>
<Serial>700029911</Serial>
<Quantity>100</Quantity>
</StockMovementData>
</StockMovementDataRequest>
output
<?xml version="1.0"?>
<StockMovementDataRequest xmlns:p1="urn:ams.com.au:dynamo:3pl:am:SAP_AM_I_005:StockMovement"
xmlns:a="http://www.edi.com.au/EnterpriseService/">
<Header>
<From>warehouse</From>
<To>client</To>
<Unique_ID>idm1467386212</Unique_ID>
<DateTimeStamp>2016-04-13T11:55:30.263+10:00</DateTimeStamp>
</Header>
<StockMovementData>
<Serialised_Material>YES</Serialised_Material>
<DateTime>2016-04-13T11:55:30.263+10:00</DateTime>
<From_Location>30-80</From_Location>
<To_Location>client</To_Location>
<Material>7CAGL3G00</Material>
<Serial>700030011</Serial>
<Quantity>100</Quantity>
</StockMovementData>
</StockMovementDataRequest>
and
<?xml version="1.0"?>
<StockMovementDataRequest xmlns:p1="urn:ams.com.au:dynamo:3pl:am:SAP_AM_I_005:StockMovement"
xmlns:a="http://www.edi.com.au/EnterpriseService/">
<Header>
<From>warehouse</From>
<To>client</To>
<Unique_ID>idm1467386212</Unique_ID>
<DateTimeStamp>2016-04-13T11:55:30.263+10:00</DateTimeStamp>
</Header>
<StockMovementData>
<Serialised_Material>YES</Serialised_Material>
<DateTime>2016-04-13T11:55:30.263+10:00</DateTime>
<From_Location>30-80</From_Location>
<To_Location>client</To_Location>
<Material>7CAGL3G00</Material>
<Serial>700029911</Serial>
<Quantity>100</Quantity>
</StockMovementData>
</StockMovementDataRequest>
Any thoughts?
If your processor supports XSLT-2.0, you can try the code below:
it outputs, output1.xml and output2.xml based on your input.
Use
Mule Splitter
to splitxml
To aggregate the payload after splitter, use
aggregator
See more documentation here https://docs.mulesoft.com/mule-user-guide/v/3.7/splitter-flow-control-reference