I have two XML files: orderlist.xml
<ListOrderItemsResponse xmlns="https://mws.amazonservices.com/Orders/2013-09-01">
<ListOrderItemsResult>
<AmazonOrderId>102-7574501-6521843</AmazonOrderId>
<OrderItems>
<OrderItem>
<ASIN>B00PBOOX6C</ASIN>
<SellerSKU>OJ-J0CO-4SEH</SellerSKU>
<OrderItemId>03136321944794</OrderItemId>
<Title>Nitric Acid 70% , ACS, REAGENT Grade, Alliance Chemical Brand, 2.5 Liter(7 Lbs) Bottle</Title>
<QuantityOrdered>1</QuantityOrdered>
<QuantityShipped>0</QuantityShipped>
<ItemPrice>
<CurrencyCode>USD</CurrencyCode>
<Amount>108.00</Amount>
</ItemPrice>
<ShippingPrice>
<CurrencyCode>USD</CurrencyCode>
<Amount>27.00</Amount>
</ShippingPrice>
<GiftWrapPrice>
<CurrencyCode>USD</CurrencyCode>
<Amount>0.00</Amount>
</GiftWrapPrice>
<ItemTax>
<CurrencyCode>USD</CurrencyCode>
<Amount>0.00</Amount>
</ItemTax>
<ShippingTax>
<CurrencyCode>USD</CurrencyCode>
<Amount>0.00</Amount>
</ShippingTax>
<GiftWrapTax>
<CurrencyCode>USD</CurrencyCode>
<Amount>0.00</Amount>
</GiftWrapTax>
<ShippingDiscount>
<CurrencyCode>USD</CurrencyCode>
<Amount>0.00</Amount>
</ShippingDiscount>
<PromotionDiscount>
<CurrencyCode>USD</CurrencyCode>
<Amount>0.00</Amount>
</PromotionDiscount>
<PromotionIds />
<ConditionId>New</ConditionId>
<ConditionSubtypeId>New</ConditionSubtypeId>
</OrderItem>
</OrderItems>
</ListOrderItemsResult>
<ResponseMetadata>
<RequestId>2b407071-501d-45a2-9baa-2f5ec24f61e7</RequestId>
</ResponseMetadata>
</ListOrderItemsResponse>
and orderlist2.xml:
<ListOrderItemsResponse xmlns="https://mws.amazonservices.com/Orders/2013-09-01">
<ListOrderItemsResult>
<AmazonOrderId>112-5324115-6814611</AmazonOrderId>
<OrderItems>
<OrderItem>
<ASIN>B00PGF7U6G</ASIN>
<SellerSKU>60-JOUW-Q8HA</SellerSKU>
<OrderItemId>19976596962514</OrderItemId>
<Title>Nitric Acid 70% , ACS REAGENT GRADE, 2.5 Liter(7 Lbs) Bottle</Title>
<QuantityOrdered>1</QuantityOrdered>
<QuantityShipped>0</QuantityShipped>
<ItemPrice>
<CurrencyCode>USD</CurrencyCode>
<Amount>108.00</Amount>
</ItemPrice>
<ShippingPrice>
<CurrencyCode>USD</CurrencyCode>
<Amount>27.00</Amount>
</ShippingPrice>
<GiftWrapPrice>
<CurrencyCode>USD</CurrencyCode>
<Amount>0.00</Amount>
</GiftWrapPrice>
<ItemTax>
<CurrencyCode>USD</CurrencyCode>
<Amount>0.00</Amount>
</ItemTax>
<ShippingTax>
<CurrencyCode>USD</CurrencyCode>
<Amount>0.00</Amount>
</ShippingTax>
<GiftWrapTax>
<CurrencyCode>USD</CurrencyCode>
<Amount>0.00</Amount>
</GiftWrapTax>
<ShippingDiscount>
<CurrencyCode>USD</CurrencyCode>
<Amount>0.00</Amount>
</ShippingDiscount>
<PromotionDiscount>
<CurrencyCode>USD</CurrencyCode>
<Amount>0.00</Amount>
</PromotionDiscount>
<PromotionIds />
<ConditionId>New</ConditionId>
<ConditionSubtypeId>New</ConditionSubtypeId>
</OrderItem>
</OrderItems>
</ListOrderItemsResult>
<ResponseMetadata>
<RequestId>e9e67246-c07d-4bf0-825b-929cd37c694f</RequestId>
</ResponseMetadata>
</ListOrderItemsResponse>
The combined XML file will look at like this:
<AmazonOrderId>112-5324115-6814611</AmazonOrderId>
<OrderItems>
<OrderItem>
<ASIN>B00PGF7U6G</ASIN>
<SellerSKU>60-JOUW-Q8HA</SellerSKU>
<OrderItemId>19976596962514</OrderItemId>
<Title>Nitric Acid 70% , ACS REAGENT GRADE, 2.5 Liter(7 Lbs) Bottle</Title>
<QuantityOrdered>1</QuantityOrdered>
<QuantityShipped>0</QuantityShipped>
<ItemPrice>
<CurrencyCode>USD</CurrencyCode>
<Amount>108.00</Amount>
</ItemPrice>
<ShippingPrice>
<CurrencyCode>USD</CurrencyCode>
<Amount>27.00</Amount>
</ShippingPrice>
<GiftWrapPrice>
<CurrencyCode>USD</CurrencyCode>
<Amount>0.00</Amount>
</GiftWrapPrice>
<ItemTax>
<CurrencyCode>USD</CurrencyCode>
<Amount>0.00</Amount>
</ItemTax>
<ShippingTax>
<CurrencyCode>USD</CurrencyCode>
<Amount>0.00</Amount>
</ShippingTax>
<GiftWrapTax>
<CurrencyCode>USD</CurrencyCode>
<Amount>0.00</Amount>
</GiftWrapTax>
<ShippingDiscount>
<CurrencyCode>USD</CurrencyCode>
<Amount>0.00</Amount>
</ShippingDiscount>
<PromotionDiscount>
<CurrencyCode>USD</CurrencyCode>
<Amount>0.00</Amount>
</PromotionDiscount>
<PromotionIds />
<ConditionId>New</ConditionId>
<ConditionSubtypeId>New</ConditionSubtypeId>
</OrderItem>
<OrderItem>
<Title>Nitric Acid 70% , ACS REAGENT GRADE, 2.5 Liter(7 Lbs)</Title>
<QuantityOrdered>1</QuantityOrdered>
<ItemPrice>
<Amount>108.00</Amount>
</ItemPrice>
<ShippingPrice>
<Amount>27.00</Amount>
</ShippingPrice>
</OrderItem>
</OrderItems>undefined</ListOrderItemsResult>undefined<ResponseMetadata>
<RequestId>e9e67246-c07d-4bf0-825b-929cd37c694f</RequestId>undefined</ResponseMetadata>
I want to append the 2nd file to the 1st file, but the only elements I want from the second file are <Title>
, <QuantityOrdered>
, <ItemPrice>
, <Amount>
, <ShippingPrice>
, <Amount>
. I think think the parent element is and the data should be encapsulated within the <OrderItem>
tag. How can I do this?