XmlReader's namespace using System.Xml;
XmlReader is the way to read the contents of an XML file by streaming
<?xml version= "1.0" encoding= "Utf-8"?>
<!--<!-–this file represents a fragment of a book store inventory database-–>-->
<bookstore>
<book genre= "Autobiography" Publicationdate= "1991" isbn= "1-861003-11-0" >
<title>the Autobiography of Benjamin franklin</title>
</bookstore>
The contents of the <title> element can be read in the following way
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Text;
Using System.Threading.Tasks;
Using System.Xml;
Namespace XmlTest
{
Class Program
{
static void Main (string[] args)
{
XmlReader RDR = xmlreader.create ("books.xml");
while (RDR. Read ())
{
if (RDR. NodeType = = XmlNodeType.Text)
{
String str = rdr. Value;
}
}
}
}
}
By setting breakpoints, you will see that XmlReader is a step-by-step reading of the contents of the file from the XML, where spaces, comments, and so on will be read
XmlReader of C # Operations XML