Reading XML with the XmlReader
The XmlReader class is an abstract base class that provides non-cached, forward-only, read-only access to XML data. It conforms to the W3C Extensible Markup Language (XML) 1.0 and the Namespaces in XML recommendations.
The XmlReader class supports reading XML data from a stream or file. It defines methods and properties that allow you to move through the data and read the contents of a node. The current node refers to the node on which the reader is positioned. The reader is advanced using any of the read methods and properties return the value of the current node.
The XmlReader class enables you to:
Verify that the characters are legal XML characters, and that element and attribute names are valid XML names.
Verify that the XML document is well formed.
Validate the data against a DTD or schema.
Retrieve data from the XML stream or skip unwanted records using a pull model.
In This Section
- New Features in the XmlReader Class
Describes changes to the XmlReader class.
- Common XmlReader Tasks
Describes the most common XmlReader tasks.
- Using the XmlReader Class
Describes how to create XmlReader instances, data validation, reading data, and so on.
- Comparing XmlReader to SAX Reader
Describes the differences between the XmlReader class and the SAX reader.
- Creating XML Readers
Describes how to create XML readers.
- Validating XML Data with XmlReader
Describes how to validate data using the XmlReader class.
- Security and Your System.Xml Applications
Discusses security issues when working with XML technologies.