这是我在此处发布的第一篇文章。我已经搜索过了,但没有找到我需要的内容。
我不确定我需要使用什么技术来完成以下操作。
我使用的是Mule 3.3 CE,并且我需要拆分XML文件。 我需要在每个拆分的XML中保留“rootElement”及其属性。 所有XML文件都将放置在同一个JMS队列中。
我知道如何拆分三个Product节点,但我如何在每个XML文件上保留“rootElement”?
XPath?XSLT?DOM并删除和添加节点?我更喜欢XPath,但它是否具备完成此操作的能力?
<?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>
在Mule 3.3 CE中,我需要分割以下内容:
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>