cancel
Showing results for 
Search instead for 
Did you mean: 

XML split in pipeline

Sahil
Contributor

I have a scenario where main xml needs to be splitted into multiple xmls.

Main xml:-

<?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>10</OrderLineNumber>
      <VendorOrderLineNumber>10000</VendorOrderLineNumber>
      <VendorPartNumber>66554</VendorPartNumber>
   </Line>
	<Line>
      <OrderLineNumber>20</OrderLineNumber>
      <VendorOrderLineNumber>20000</VendorOrderLineNumber>
      <VendorPartNumber>6775</VendorPartNumber>
    </Line>
  </Lines>
</Order>

Split xml 1:-

<?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>10</OrderLineNumber>
      <VendorOrderLineNumber>10000</VendorOrderLineNumber>
      <VendorPartNumber>66554</VendorPartNumber>
   </Line>
  </Lines>
</Order>

split xml 2:-

<?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>
    </Line>
  </Lines>
</Order>

how do I achieve it?

1 ACCEPTED SOLUTION

viktor_n
Contributor II

Try this one. Now even if it’s only one Line it will work.
Split_XML_Parent_2021_08_01.slp (13.0 KB)

Child pipeline is the same as above.

Regards,
Viktor

View solution in original post

10 REPLIES 10

viktor_n
Contributor II

Try this one. Now even if it’s only one Line it will work.
Split_XML_Parent_2021_08_01.slp (13.0 KB)

Child pipeline is the same as above.

Regards,
Viktor