My first post is here. I searched, but did not find what I was looking for.
I'm not quite sure what technique I need to do.
I am using Mule 3.3 CE and I need to split the XML files. I need to store the "rootElement" and its attributes in each shared XML. All XML files will be deleted in the same JMS queue.
I know how to separate the three Product nodes, but how can I save the "rootElement" in each XML file?
XPath? XSLT? DOM and delete and add nodes? I would rather just have XPath, but does it have the power to do this?
<?xml version="1.0" encoding="ISO-8859-1"?> <rootElement xmlns="http://Ecommerce.com/schemas/loyalist/3" preOrderTo="2012-12-31T23:59:59" currency="GBP" timeStamp="2012-08-15T23:59:59"> <Product itemID="09999-3-" name="Plate" description="Plate of blue man" tax="0.00" eanCode="1234567890123" eanType="EAN 13"/> <priceBracket quantity="1" price="10.98" grossPrice="13.00"/> <Product itemID="12345-3-" name="Plate" description="Plate of black man" tax="0.00" eanCode="1234569870123" eanType="EAN 13"/> <priceBracket quantity="1" price="15.98" grossPrice="18.00"/> <Product itemID="98765-3-" name="Plate" description="Plate of yellow man" tax="0.00" eanCode="7894567890123" eanType="EAN 13"/> <priceBracket quantity="1" price="20.98" grossPrice="24.00"/> </rootElement>
What I need in Mule 3.3 CE is the following split:
1.
<?xml version="1.0" encoding="ISO-8859-1"?> <rootElement xmlns="http://Ecommerce.com/schemas/loyalist/3" preOrderTo="2012-12-31T23:59:59" currency="GBP" timeStamp="2012-08-15T23:59:59"> <Product itemID="09999-3-" name="Plate" description="Plate of blue man" tax="0.00" eanCode="1234567890123" eanType="EAN 13"/> <priceBracket quantity="1" price="10.98" grossPrice="13.00"/> </rootElement>
2.
<?xml version="1.0" encoding="ISO-8859-1"?> <rootElement xmlns="http://Ecommerce.com/schemas/loyalist/3" preOrderTo="2012-12-31T23:59:59" currency="GBP" timeStamp="2012-08-15T23:59:59"> <Product itemID="12345-3-" name="Plate" description="Plate of black man" tax="0.00" eanCode="1234569870123" eanType="EAN 13"/> <priceBracket quantity="1" price="15.98" grossPrice="18.00"/> </rootElement>
3.
<?xml version="1.0" encoding="ISO-8859-1"?> <rootElement xmlns="http://Ecommerce.com/schemas/loyalist/3" preOrderTo="2012-12-31T23:59:59" currency="GBP" timeStamp="2012-08-15T23:59:59"> <Product itemID="98765-3-" name="Plate" description="Plate of yellow man" tax="0.00" eanCode="7894567890123" eanType="EAN 13"/> <priceBracket quantity="1" price="20.98" grossPrice="24.00"/> </rootElement>
source share