View Single Post
  #1 (permalink)  
Old March 14th, 2008, 01:28 AM
vikkiefd vikkiefd is offline
Authorized User
 
Join Date: Mar 2008
Location: , , .
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default Pickingup sub elements from its parent

The following is my scenario:
Actually I want to pickup a set of child elements of its parent.These set of child elements may occur multiple times also within that parent, but they are not covered with any more container element.

The following is my input xml:
<?xml version = "1.0" encoding = "utf-8"?>
<DataSet>
 <FirstData>
   <DataDesc></DataDesc>
   <DataType></DataType>
   <Item></Item>
   <Description></Description>
   <Item></Item>
   <Description></Description>
 </FirstData>
</DataSet>

The output should be like this:
<?xml version = "1.0" encoding = "utf-8"?>
<DataSet>
 <FirstData>
  <DataDesc></DataDesc>
  <DataType></DataType>
  <Data no="1">
   <Item></Item>
   <Description></Description>
  </Data>
  <Data no="2">
   <Item></Item>
   <Description></Description>
  </Data>
 </FirstData>
</DataSet>

How to achieve this output. Please help me to resolve this. Thanks in advance for your help.

Regards,
Viki



Reply With Quote