XmlReaderCF 1.0, ECMA 1.0

System.Xml (system.xml.dll)abstract class

This class is a simple reader for XML documents. XmlReader provides a non-cached, forward-only navigation through an XML data stream. It does not provide validation, nor does it expand general entities. Two derived classes provide these features: XmlTextReader and XmlValidatingReader.

The XmlReader class parses XML in a streaming-based approach (exemplified by the SAX specification). This means the XML parser presents "interesting pieces" (elements, attributes, namespace declarations, and so forth) in a linear order. Within XmlReader, this ordering of nodes is done using successive calls to the Read( ) method. An XmlReader is not positioned on a node at firstan initial call to Read( ) is required to move to the root node of a document. Subsequent calls to Read( ) move the reader sequentially through the nodes. The NodeType property tells you which type of node the reader is currently positioned on, returning values from the XmlNodeType enumeration. A special node-type value for XmlReader is EndElement. As Read( ) moves through the stream, it can be positioned on an element's end tag after it has stepped through the element's children. This is not a real node, in the DOM sense, but is required for XmlReader to parse XML data properly. The Skip( ) method steps through data node by node. A call to Skip( ) moves the reader to the next real node, disregarding the current node's children.

XML documents can also be parsed in a tree-based approach, using the XmlDocument type.

public abstract class XmlReader {
// Protected Constructors
   protected XmlReader( );
// Public Instance Properties
   public abstract int AttributeCount{get; }
   public abstract string BaseURI{get; }
   public virtual bool CanResolveEntity{get; }
   public abstract int Depth{get; }
   public abstract bool EOF{get; }
   public virtual bool HasAttributes{get; }
   public abstract bool HasValue{get; }
   public abstract bool IsDefault{get; }
   public abstract bool IsEmptyElement{get; }
   public abstract string LocalName{get; }
   public abstract string Name{get; }
   public abstract string NamespaceURI{get; }
   public abstract XmlNameTable NameTable{get; }
   public abstract XmlNodeType NodeType{get; }
   public abstract string Prefix{get; }
   public abstract char QuoteChar{get; }
   public abstract ReadState ReadState{get; }
   public abstract string this[string name, string namespaceURI]{get; }
   public abstract string this[int i]{get; }
   public abstract string this[string name]{get; }
   public abstract string Value{get; }
   public abstract string XmlLang{get; }
   public abstract XmlSpace XmlSpace{get; }
// Public Static Methods
   public static bool IsName(string str);
   public static bool IsNameToken(string str);
// Public Instance Methods
   public abstract void Close( );
   public abstract string GetAttribute(int i);
   public abstract string GetAttribute(string name);
   public abstract string GetAttribute(string name, string namespaceURI);
   public virtual bool IsStartElement( );
   public virtual bool IsStartElement(string name);
   public virtual bool IsStartElement(string localname, string ns);
   public abstract string LookupNamespace(string prefix);
   public abstract bool MoveToAttribute(string name);
   public abstract bool MoveToAttribute(string name, string ns);
   public abstract void MoveToAttribute(int i);
   public virtual XmlNodeType MoveToContent( );
   public abstract bool MoveToElement( );
   public abstract bool MoveToFirstAttribute( );
   public abstract bool MoveToNextAttribute( );
   public abstract bool Read( );
   public abstract bool ReadAttributeValue( );
   public virtual string ReadElementString( );
   public virtual string ReadElementString(string name);
   public virtual string ReadElementString(string localname, string ns);
   public virtual void ReadEndElement( );
   public virtual string ReadInnerXml( );
   public virtual string ReadOuterXml( );
   public virtual void ReadStartElement( );
   public virtual void ReadStartElement(string name);
   public virtual void ReadStartElement(string localname, string ns);
   public virtual string ReadString( );
   public abstract void ResolveEntity( );
   public virtual void Skip( );


XmlNodeReader, XmlTextReader, XmlValidatingReader

Returned By

XmlValidatingReader.Reader, System.Xml.Xsl.XslTransform.Transform( )

Passed To

XmlDocument.{Load( ), ReadNode( )}, XmlValidatingReader.XmlValidatingReader( ), XmlWriter.{WriteAttributes( ), WriteNode( )}, System.Xml.XPath.XPathDocument.XPathDocument( ), System.Xml.Xsl.XslTransform.Load( )

    Part II: Programming with the .NET Framework
    Part IV: API Quick Reference
    Chapter 26. System