what is xml text readerthe xmltextreader class


What is XML Text Reader?

The "XmlTextReader" class helps to give fast access to streams of XML data in a forward-only and read-only manner. The XMLTextReader also checks if the XML is well-formed. But the XMLTextReader does not validate against a schema or DTD for that you will need "XmlNodeReader" or "XmlValidatingReader" class.

The Instance of "XmlTextReader" can be created in number of ways. For e.g.  If you want to load a file from a disk you can use the below snippets.

XmlTextReader reader = new XmlTextReader(fileName);

To loop through all the nodes you require to call the "read ()" method of the "XmlTextreader" object. The "read()" method gives "true" if there are records in the XML document or else it returns "false".

//Open the stream

XmlTextReader reader = new XmlTextReader(file);

while (reader.Read())

{

// your logic goes here string pdata = reader.Value

 }

// Close the stream

reader.Close();

Request for Solution File

Ask an Expert for Answer!!
DOT NET Programming: what is xml text readerthe xmltextreader class
Reference No:- TGS0161423

Expected delivery within 24 Hours