Reading Xml File contents?

Hi all,

I'm trying to read the contents of an Xml file. I tried soemthing like this.

XmlDocument doc = new XmlDocument();

doc.Load(<XmlFile>);

I need to access the nodes with the Tagname "Object" So I tried,

XmlNodeList list = doc.GetElementsbyTagName("Object");

Further I couldn't access the contents within this node.

I mean withing this <Object> Tag, I have some data which I need to access. I didn't get how to reach to those contents within <Object> and </Object> tags.

Am I using the proper method for reading the Xml files anybody pls let me know how to access the data from an Xml file.

Thank you all.

Soujanya.




Answer this question

Reading Xml File contents?

  • Antonio_I

    Hi,

    have a look at following,

    XmlNodeList elemList = doc.GetElementsByTagName("title");
    for (int i=0; i < elemList.Count; i++)
    {
    Console.WriteLine(elemListIdea.InnerXml);
    }


    Shamir

  • Reading Xml File contents?