How to read a XML on csharp

Code Example - How to read a XML on csharp

                
                        XmlDocument doc = new XmlDocument();
            doc.Load(path);
            doc.Save(Console.Out);

            foreach (XmlNode node in doc.DocumentElement)
            {
                string word_name = node.Attributes[0].Value;
                string word_translation = node["name of node"].InnerText;
            }
                    
                
 

read xml file csharp

                        
                                XmlDocument doc = new XmlDocument();
using (StreamReader streamReader = new StreamReader(path_name, Encoding.UTF8))
{
	contents = streamReader.ReadToEnd();
}
doc.LoadXml(contents);
                            
                        
 

Related code examples