Read XML file into XmlDocument

后端 未结 5 1066
孤街浪徒
孤街浪徒 2020-12-24 00:11

I am very new to C#. I have XML file (text.xml). I want to read that in XmlDocument and store the stream in string variable.

5条回答
  •  南笙
    南笙 (楼主)
    2020-12-24 00:42

    XmlDocument doc = new XmlDocument();
       doc.Load("MonFichierXML.xml");
    
        XmlNode node = doc.SelectSingleNode("Magasin");
    
        XmlNodeList prop = node.SelectNodes("Items");
    
        foreach (XmlNode item in prop)
        {
            items Temp = new items();
            Temp.AssignInfo(item);
            lstitems.Add(Temp);
        }
    

提交回复
热议问题