AnsweredAssumed Answered

Splitting XML documents

Question asked by RanjiniElamkulammana2391 on Feb 23, 2017
Latest reply on Feb 24, 2017 by britto.parthalomew

Hi 

 

I have an XML as shown

<products>

<product id="1000" type="xyz"/>

<product id="1001" parent id="1000" type="xyz"/>

<product id="1002" parent id="1000" type="xyz"/>

<product id="1003" parent id="1000" type="xyz"/>

<product id="2000" type="xyz"/>

<product id="2001" parent id="2000" type="abc"/>

<product id="2002" parent id="2000" type="abc"/>

<product id="3000" type="abc"/>

</products>

 

How can i split the above document so that it will give me 3 documents  as given below

doc 1

-------------------

<products>

<product id="1000" type="xyz"/>

<product id="1001" parent id="1000" type="xyz"/>

<product id="1002" parent id="1000" type="xyz"/>

<product id="1003" parent id="1000" type="xyz"/>

</products>

 

doc 2

------------------

<products>

<product id="2000" type="xyz"/>

<product id="2001" parent id="2000" type="abc"/>

<product id="2002" parent id="2000" type="abc"/>

</products>

 

doc 3

----------------------------------

<products>

<product id="3000" type="abc"/>

</products>

Outcomes