create xml from existing xml file - somebody help me on this please
Hi all,
I want to retrieve specific nodes and create a new xml from that.
I have XML file as shown below:
Code:
<log>
<ID>1502</ID>
<Brand>green</Brand>
<Type>fruits</Type>
<FruitsInfo>
<ShopNo>1000</ShopNo>
<date>18-Apr-2005</date>
<time>16:14:22<time>
<Stock>
<item>Banana</item>
<item>Apple</item>
<item>Grapes</item>
<item>Mango</item>
<item>Others</item>
</Stock>
</FruitsInfo>
<FruitsInfo>
<ShopNo>1001</ShopNo>
<date>18-Apr-2005</date>
<time>16:14:22<time>
<Stock>
<item>Banana</item>
<item>Apple</item>
<item>Grapes</item>
<item>Mango</item>
<item>Others</item>
</Stock>
</FruitsInfo>
</log>
I need output xml for a given shop number. Let's say the user wants to know about shop no: 1000, then the output xml should be:
Code:
<log>
<ID>1502</ID>
<Brand>green</Brand>
<Type>fruits</Type>
<FruitsInfo>
<ShopNo>1000</ShopNo>
<date>18-Apr-2005</date>
<time>16:14:22<time>
<Stock>
<item>Banana</item>
<item>Apple</item>
<item>Grapes</item>
<item>Mango</item>
<item>Others</item>
</Stock>
</FruitsInfo>
</log>
i.e., I want to extract all nodes for given shop no and all the lines/nodes before "FruitsInfo" node.
Thanks in advance.
Kanna.
Re: Need Help to create a xml from existing xml file.
You should be able to apply the techniques I've shown you in your other post to this problem.
Regards,
- Aaron.
Re: Need Help to create a xml from existing xml file.
Thanks!
But what I want to do is:
Code:
'~~~~~~~~~~~~~~~Header Part Begin~~~~~~~~~~~~~~~
<log>
<ID>1502</ID>
<Brand>green</Brand>
<Type>fruits</Type>
'~~~~~~~~~~~~~~~ Header Part End ~~~~~~~~~~~~~~~
<FruitsInfo>
<ShopNo>1000</ShopNo>
<date>18-Apr-2005</date>
<time>16:14:22<time>
<Stock>
<item>Banana</item>
<item>Apple</item>
<item>Grapes</item>
<item>Mango</item>
<item>Others</item>
</Stock>
</FruitsInfo>
<FruitsInfo>
<ShopNo>1001</ShopNo>
<date>18-Apr-2005</date>
<time>16:14:22<time>
<Stock>
<item>Banana</item>
<item>Apple</item>
<item>Grapes</item>
<item>Mango</item>
<item>Others</item>
</Stock>
</FruitsInfo>
</log>
As I told in my previous post I want to create a new xml file with header part and with nodes for a given shop no. Please refer post #1 for example output file.
The number of lines in header part may differ. Simply saying, the header part is from the very first line to the line till it finds the <FruitsInfo> node.
Thanks in advance.
Re: create xml from existing xml file - somebody help me on this please
somebody help me on this please