Hi @Sahil,
I am attaching pipelines which I think will solve your problem.
Pipelines are similar to the pipelines of @rsramkoski with a little changes.
Here are the pipelines:
Split_XML_Parent_2021_07_31.slp (9.8 KB)
Split_XML_Child_2021_07_31.slp (4.0 KB)
-
The reason why you was getting different structure of the XML document was in XML Formatter snap if you not remove DocumentRoot value from the Root Element field, the snap automatically will add root element to prevent failing the process if came more than one document on input. I removed the value from Root Element and with that the snap will not add another root element on top of the current one.
![]()
-
The data from $Lines.Line
was moved on root because of the Splitter snap and here in the Mapper after the Splitter I wrote this expression(You also if you want can map the fields without the expression).
$Order.extend({Lines: {Line: $.filter((x,k) => k != "Order")}})
- If you not know what the expression is doing, here is the explanation:
It will extend the Order object with the Lines.Line object and inside will add all fields from root except of Order itself.
Here is also example of how it looks like one file on output:
<?xml version='1.0' encoding='UTF-8'?>
<Order>
<Main>
<Version>2.1</Version>
<SenderID>55544566</SenderID>
</Main>
<Data>
<OrderNumber>564434555</OrderNumber>
<OrderDate>2021-07-15</OrderDate>
<CurrencyCode>eur</CurrencyCode>
</Data>
<Lines>
<Line>
<OrderLineNumber>20</OrderLineNumber>
<VendorOrderLineNumber>20000</VendorOrderLineNumber>
<VendorPartNumber>6775</VendorPartNumber>
<Orgs>
<Org>
<Type>All</Type>
<Quantity>3</Quantity>
</Org>
</Orgs>
<Code>OK</Code>
</Line>
</Lines>
</Order>