Click here to Skip to main content
15,887,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi guys,

i have a xml table like this:
<rootnode>

<parent1>
<child> text1 </child>
</parent1>

<parent2>
<child> text2 </child>
</parent2>
<parent3>
<child> text3</child>
</parent3>

</rootnode>


i want to store only noed list in a dataset or an arraylist. which only read - parent1, parent2, parent3. not like this. parent1,child,text,parent2,child,text etc..

please help me this..
Posted
Updated 11-Sep-11 21:22pm
v2
Comments
Prerak Patel 12-Sep-11 3:23am    
Use code block for code segments.

Simply access
VB
objXmlDoc.DocumentElement
that is the root element as an XmlElement object.
 
Share this answer
 
C#
System.Xml.XmlDocument xdoc = new System.Xml.XmlDocument();
xdoc.LoadXml("<rootnode><parent1><child> text1 </child></parent1><parent2><child> text2 </child></parent2><parent3><child> text3</child></parent3></rootnode>");
foreach (System.Xml.XmlNode xnode in xdoc.DocumentElement.ChildNodes) {
    // use xnode.Name

}
 
Share this answer
 
have you tried to get the nodes and then convert to list?
 
Share this answer
 
Comments
Member 8214635 12-Sep-11 3:33am    
i want only get node in array list, no element, no child nodes.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900