Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
What is XMLTextReader
What is XMLTextReader?
✍: Guest
The “XmlTextReader” class helps to provide fast access to streams of XML data in a
forward-only and read-only manner. It also checks if the XML is well-formed. But
XMLTextReader does not validate against a schema or DTD for that you will need
“XmlNodeReader” or “XmlValidatingReader” class
Instance of “XmlTextReader” can be created in number of ways. For example if you
want to load file from a disk you can use the below snippets.
XmlTextReader reader = new XmlTextReader(fileName);.
To loop through all the nodes you need to call the “read()” method of the “XmlTextreader”
object. “read()” method returns “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();
To read the content of the current node on which the reader object is you use the “value” property. As shown in the above code “pdata” gets the value from the XML using “reader.value”.
2007-10-31, 6081👍, 0💬
Popular Posts:
How Do You Uninstall JUnit Uninstalling JUnit is easy. Just remember these: Delete the directory tha...
Which is the best place to store ConnectionString in Dot Net Projects? I am about to deploy my first...
What will happen in these three cases? if (a=0) { //somecode } if (a==0) { //do something } if (a===...
When should the method invokeLater() be used? This method is used to ensure that Swing components ar...
What is Traceability Matrix? Traceability Matrix is one of the document will prepare by QA.To make s...