How can I iterate though each child node in an XML file?

后端 未结 7 866
说谎
说谎 2021-01-04 00:49

I have an XML File and i would like to iterate though each child node gathering information.

Here is my C# code it only picks up one node, the FieldData i would like

相关标签:
7条回答
  • 2021-01-04 01:42

    I generally prefer Linq-To-Xml for this kind of thing:

      var doc = XDocument.Load("XMLFile1.xml");
      foreach (var child in doc.Element("FieldData").Elements())
      {
        Console.WriteLine(child.Name);
      }
    
    0 讨论(0)
提交回复
热议问题