1
Answer

Getting the values in each node in a xml file into a list

<SubTexture name="explosion0000.png" x="180" y="474" width="24" height="25"/>
<SubTexture name="explosion0001.png" x="422" y="609" width="30" height="30"/>
<SubTexture name="explosion0002.png" x="395" y="981" width="34" height="34"/>
<SubTexture name="explosion0003.png" x="354" y="981" width="39" height="39"/>
 
I need to get ["explosion000.png, "180", "474", "24", "25"] and the rest of the data too in a similar manner into a list. Each group will be a sublist.
 
How do I do that? Can someone help?
Answers (1)
0
Laxmidhar Sahoo

Laxmidhar Sahoo

NA 2.3k 1.4k 7y
sir 
add the namespace in your form at the top
using System.Xml; 
 
load your xmlfile like below code 
  1. public void addlist()  
  2.        {  
  3.        XmlDocument xdoc = new XmlDocument();  
  4.        xdoc.LoadXml("XmlName.xml");  
  5.   
  6.        }  
from xdoc you can retrive the node and add in the list