Answers for "method to retrieve elements from xml c#"

C#
0

method to retrieve elements from xml c#

using System;
using System.IO;
using System.Xml;

public class Sample
{
  public static void Main()
  {
    //Create the XmlDocument.
    XmlDocument doc = new XmlDocument();
    doc.Load("books.xml");

    //Display all the book titles.
    XmlNodeList elemList = doc.GetElementsByTagName("title");
    for (int i=0; i < elemList.Count; i++)
    {
      Console.WriteLine(elemList[i].InnerXml);
    }
  }
}
Posted by: Guest on August-03-2020

Code answers related to "method to retrieve elements from xml c#"

C# Answers by Framework

Browse Popular Code Answers by Language