XmlNodeReader XmlNodeReader XmlNodeReader XmlNodeReader Class

Definition

Represents a reader that provides fast, non-cached forward only access to XML data in an XmlNode.

public ref class XmlNodeReader : System::Xml::XmlReader, System::Xml::IXmlNamespaceResolver
public class XmlNodeReader : System.Xml.XmlReader, System.Xml.IXmlNamespaceResolver
type XmlNodeReader = class
    inherit XmlReader
    interface IXmlNamespaceResolver
Public Class XmlNodeReader
Inherits XmlReader
Implements IXmlNamespaceResolver
Inheritance
XmlNodeReaderXmlNodeReaderXmlNodeReaderXmlNodeReader
Implements

Examples

In the following example, an XML file is loaded into an XML document and modified. The XML document is passed to an XmlNodeReader, which is then passed to the XmlReader.Create method. When the validating reader parses the file, it can validate any changes made to the XML file.

using System;
using System.Xml;
using System.Xml.Schema;
using System.IO;

public class Sample {

  public static void Main() {

    // Create and load the XML document.
    XmlDocument doc = new XmlDocument();
    doc.Load("booksSchema.xml");

    // Make changes to the document.
    XmlElement book = (XmlElement) doc.DocumentElement.FirstChild;
    book.SetAttribute("publisher", "Worldwide Publishing");

    // Create an XmlNodeReader using the XML document.
    XmlNodeReader nodeReader = new XmlNodeReader(doc);

    // Set the validation settings on the XmlReaderSettings object.
    XmlReaderSettings settings = new XmlReaderSettings();
    settings.ValidationType = ValidationType.Schema;
    settings.Schemas.Add("urn:bookstore-schema", "books.xsd");
    settings.ValidationEventHandler += new ValidationEventHandler (ValidationCallBack);

   // Create a validating reader that wraps the XmlNodeReader object.
   XmlReader reader = XmlReader.Create(nodeReader, settings);
    
   // Parse the XML file.
   while (reader.Read());
  }

  // Display any validation errors.
  private static void ValidationCallBack(object sender, ValidationEventArgs e) {
    Console.WriteLine("Validation Error: {0}", e.Message);
  }
}
Imports System
Imports System.Xml
Imports System.Xml.Schema
Imports System.IO

public class Sample 

  public shared sub Main() 

    ' Create and load the XML document.
    Dim doc as XmlDocument = new XmlDocument()
    doc.Load("booksSchema.xml")

    ' Make changes to the document.
    Dim book as XmlElement
    book = CType(doc.DocumentElement.FirstChild, XmlElement)
    book.SetAttribute("publisher", "Worldwide Publishing")

    ' Create an XmlNodeReader using the XML document.
    Dim nodeReader as XmlNodeReader = new XmlNodeReader(doc)

    ' Set the validation settings on the XmlReaderSettings object.
    Dim settings as XmlReaderSettings = new XmlReaderSettings()
    settings.ValidationType = ValidationType.Schema
    settings.Schemas.Add("urn:bookstore-schema", "books.xsd")
    AddHandler settings.ValidationEventHandler, AddressOf ValidationCallBack

    ' Create a validating reader that wraps the XmlNodeReader object.
    Dim reader as XmlReader = XmlReader.Create(nodeReader,settings)
    
    ' Parse the XML file.
    while (reader.Read())
    end while
  end sub

  ' Display any validation errors.
  private shared sub ValidationCallBack(sender as object, e as ValidationEventArgs)
    Console.WriteLine("Validation Error: {0}", e.Message)
  end sub

end class

Input

The following files are used as input.

bookSchema.xml

<?xml version='1.0'?>
<bookstore xmlns="urn:bookstore-schema">
  <book genre="autobiography">
    <title>The Autobiography of Benjamin Franklin</title>
    <author>
      <first-name>Benjamin</first-name>
      <last-name>Franklin</last-name>
    </author>
    <price>8.99</price>
  </book>
  <book genre="novel">
    <title>The Confidence Man</title>
    <author>
      <first-name>Herman</first-name>
      <last-name>Melville</last-name>
    </author>
    <price>11.99</price>
  </book>
</bookstore>

books.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="urn:bookstore-schema"
    elementFormDefault="qualified"
    targetNamespace="urn:bookstore-schema">

 <xsd:element name="bookstore" type="bookstoreType"/>

 <xsd:complexType name="bookstoreType">
  <xsd:sequence maxOccurs="unbounded">
   <xsd:element name="book"  type="bookType"/>
  </xsd:sequence>
 </xsd:complexType>

 <xsd:complexType name="bookType">
  <xsd:sequence>
   <xsd:element name="title" type="xsd:string"/>
   <xsd:element name="author" type="authorName"/>
   <xsd:element name="price"  type="xsd:decimal"/>
  </xsd:sequence>
  <xsd:attribute name="genre" type="xsd:string"/>
 </xsd:complexType>

 <xsd:complexType name="authorName">
  <xsd:sequence>
   <xsd:element name="first-name"  type="xsd:string"/>
   <xsd:element name="last-name" type="xsd:string"/>
  </xsd:sequence>
 </xsd:complexType>

</xsd:schema>

Output

Validation Error: The 'publisher' attribute is not declared.

Remarks

Note

Instead of using the XmlNodeReader, we recommend that you create XmlReader instances by using the XmlReaderSettings class and the Create method. This enables you to take advantage of conformance checking and compliance to the XML 1.0 recommendation.

The XmlNodeReader has the ability to read an XML DOM subtree. This class does not support document type definition (DTD) or schema validation. However, you can create an XmlReader object that wraps around the XmlNodeReader object to validate the data stored in the XmlNodeReader object, as shown in Examples section.

Constructors

XmlNodeReader(XmlNode) XmlNodeReader(XmlNode) XmlNodeReader(XmlNode) XmlNodeReader(XmlNode)

Creates an instance of the XmlNodeReader class using the specified XmlNode.

Properties

AttributeCount AttributeCount AttributeCount AttributeCount

Gets the number of attributes on the current node.

BaseURI BaseURI BaseURI BaseURI

Gets the base URI of the current node.

CanReadBinaryContent CanReadBinaryContent CanReadBinaryContent CanReadBinaryContent

Gets a value indicating whether the XmlNodeReader implements the binary content read methods.

CanReadValueChunk CanReadValueChunk CanReadValueChunk CanReadValueChunk

Gets a value indicating whether the XmlReader implements the ReadValueChunk(Char[], Int32, Int32) method.

(Inherited from XmlReader)
CanResolveEntity CanResolveEntity CanResolveEntity CanResolveEntity

Gets a value indicating whether this reader can parse and resolve entities.

Depth Depth Depth Depth

Gets the depth of the current node in the XML document.

EOF EOF EOF EOF

Gets a value indicating whether the reader is positioned at the end of the stream.

HasAttributes HasAttributes HasAttributes HasAttributes

Gets a value indicating whether the current node has any attributes.

HasValue HasValue HasValue HasValue

Gets a value indicating whether the current node can have a Value.

IsDefault IsDefault IsDefault IsDefault

Gets a value indicating whether the current node is an attribute that was generated from the default value defined in the document type definition (DTD) or schema.

IsEmptyElement IsEmptyElement IsEmptyElement IsEmptyElement

Gets a value indicating whether the current node is an empty element (for example, <MyElement/>).

Item[Int32] Item[Int32] Item[Int32] Item[Int32]
Item[String, String] Item[String, String] Item[String, String] Item[String, String]
Item[String] Item[String] Item[String] Item[String]
LocalName LocalName LocalName LocalName

Gets the local name of the current node.

Name Name Name Name

Gets the qualified name of the current node.

NamespaceURI NamespaceURI NamespaceURI NamespaceURI

Gets the namespace URI (as defined in the W3C Namespace specification) of the node on which the reader is positioned.

NameTable NameTable NameTable NameTable

Gets the XmlNameTable associated with this implementation.

NodeType NodeType NodeType NodeType

Gets the type of the current node.

Prefix Prefix Prefix Prefix

Gets the namespace prefix associated with the current node.

QuoteChar QuoteChar QuoteChar QuoteChar
ReadState ReadState ReadState ReadState

Gets the state of the reader.

SchemaInfo SchemaInfo SchemaInfo SchemaInfo

Gets the schema information that has been assigned to the current node.

Settings Settings Settings Settings

Gets the XmlReaderSettings object used to create this XmlReader instance.

(Inherited from XmlReader)
Value Value Value Value

Gets the text value of the current node.

ValueType ValueType ValueType ValueType

Gets The Common Language Runtime (CLR) type for the current node.

(Inherited from XmlReader)
XmlLang XmlLang XmlLang XmlLang

Gets the current xml:lang scope.

XmlSpace XmlSpace XmlSpace XmlSpace

Gets the current xml:space scope.

Methods

Close() Close() Close() Close()

Changes the ReadState to Closed.

Dispose() Dispose() Dispose() Dispose()

Releases all resources used by the current instance of the XmlReader class.

(Inherited from XmlReader)
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

Releases the unmanaged resources used by the XmlReader and optionally releases the managed resources.

(Inherited from XmlReader)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetAttribute(Int32) GetAttribute(Int32) GetAttribute(Int32) GetAttribute(Int32)

Gets the value of the attribute with the specified index.

GetAttribute(String) GetAttribute(String) GetAttribute(String) GetAttribute(String)

Gets the value of the attribute with the specified name.

GetAttribute(String, String) GetAttribute(String, String) GetAttribute(String, String) GetAttribute(String, String)

Gets the value of the attribute with the specified local name and namespace URI.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
GetValueAsync() GetValueAsync() GetValueAsync() GetValueAsync()

Asynchronously gets the value of the current node.

(Inherited from XmlReader)
IsStartElement() IsStartElement() IsStartElement() IsStartElement()

Calls MoveToContent() and tests if the current content node is a start tag or empty element tag.

(Inherited from XmlReader)
IsStartElement(String) IsStartElement(String) IsStartElement(String) IsStartElement(String)

Calls MoveToContent() and tests if the current content node is a start tag or empty element tag and if the Name property of the element found matches the given argument.

(Inherited from XmlReader)
IsStartElement(String, String) IsStartElement(String, String) IsStartElement(String, String) IsStartElement(String, String)

Calls MoveToContent() and tests if the current content node is a start tag or empty element tag and if the LocalName and NamespaceURI properties of the element found match the given strings.

(Inherited from XmlReader)
LookupNamespace(String) LookupNamespace(String) LookupNamespace(String) LookupNamespace(String)

Resolves a namespace prefix in the current element's scope.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
MoveToAttribute(Int32) MoveToAttribute(Int32) MoveToAttribute(Int32) MoveToAttribute(Int32)

Moves to the attribute with the specified index.

MoveToAttribute(String) MoveToAttribute(String) MoveToAttribute(String) MoveToAttribute(String)

Moves to the attribute with the specified name.

MoveToAttribute(String, String) MoveToAttribute(String, String) MoveToAttribute(String, String) MoveToAttribute(String, String)

Moves to the attribute with the specified local name and namespace URI.

MoveToContent() MoveToContent() MoveToContent() MoveToContent()

Checks whether the current node is a content (non-white space text, CDATA, Element, EndElement, EntityReference, or EndEntity) node. If the node is not a content node, the reader skips ahead to the next content node or end of file. It skips over nodes of the following type: ProcessingInstruction, DocumentType, Comment, Whitespace, or SignificantWhitespace.

(Inherited from XmlReader)
MoveToContentAsync() MoveToContentAsync() MoveToContentAsync() MoveToContentAsync()

Asynchronously checks whether the current node is a content node. If the node is not a content node, the reader skips ahead to the next content node or end of file.

(Inherited from XmlReader)
MoveToElement() MoveToElement() MoveToElement() MoveToElement()

Moves to the element that contains the current attribute node.

MoveToFirstAttribute() MoveToFirstAttribute() MoveToFirstAttribute() MoveToFirstAttribute()

Moves to the first attribute.

MoveToNextAttribute() MoveToNextAttribute() MoveToNextAttribute() MoveToNextAttribute()

Moves to the next attribute.

Read() Read() Read() Read()

Reads the next node from the stream.

ReadAsync() ReadAsync() ReadAsync() ReadAsync()

Asynchronously reads the next node from the stream.

(Inherited from XmlReader)
ReadAttributeValue() ReadAttributeValue() ReadAttributeValue() ReadAttributeValue()

Parses the attribute value into one or more Text, EntityReference, or EndEntity nodes.

ReadContentAs(Type, IXmlNamespaceResolver) ReadContentAs(Type, IXmlNamespaceResolver) ReadContentAs(Type, IXmlNamespaceResolver) ReadContentAs(Type, IXmlNamespaceResolver)

Reads the content as an object of the type specified.

(Inherited from XmlReader)
ReadContentAsAsync(Type, IXmlNamespaceResolver) ReadContentAsAsync(Type, IXmlNamespaceResolver) ReadContentAsAsync(Type, IXmlNamespaceResolver) ReadContentAsAsync(Type, IXmlNamespaceResolver)

Asynchronously reads the content as an object of the type specified.

(Inherited from XmlReader)
ReadContentAsBase64(Byte[], Int32, Int32) ReadContentAsBase64(Byte[], Int32, Int32) ReadContentAsBase64(Byte[], Int32, Int32) ReadContentAsBase64(Byte[], Int32, Int32)

Reads the content and returns the Base64 decoded binary bytes.

ReadContentAsBase64Async(Byte[], Int32, Int32) ReadContentAsBase64Async(Byte[], Int32, Int32) ReadContentAsBase64Async(Byte[], Int32, Int32) ReadContentAsBase64Async(Byte[], Int32, Int32)

Asynchronously reads the content and returns the Base64 decoded binary bytes.

(Inherited from XmlReader)
ReadContentAsBinHex(Byte[], Int32, Int32) ReadContentAsBinHex(Byte[], Int32, Int32) ReadContentAsBinHex(Byte[], Int32, Int32) ReadContentAsBinHex(Byte[], Int32, Int32)

Reads the content and returns the BinHex decoded binary bytes.

ReadContentAsBinHexAsync(Byte[], Int32, Int32) ReadContentAsBinHexAsync(Byte[], Int32, Int32) ReadContentAsBinHexAsync(Byte[], Int32, Int32) ReadContentAsBinHexAsync(Byte[], Int32, Int32)

Asynchronously reads the content and returns the BinHex decoded binary bytes.

(Inherited from XmlReader)
ReadContentAsBoolean() ReadContentAsBoolean() ReadContentAsBoolean() ReadContentAsBoolean()

Reads the text content at the current position as a Boolean.

(Inherited from XmlReader)
ReadContentAsDateTime() ReadContentAsDateTime() ReadContentAsDateTime() ReadContentAsDateTime()

Reads the text content at the current position as a DateTime object.

(Inherited from XmlReader)
ReadContentAsDateTimeOffset() ReadContentAsDateTimeOffset() ReadContentAsDateTimeOffset() ReadContentAsDateTimeOffset()

Reads the text content at the current position as a DateTimeOffset object.

(Inherited from XmlReader)
ReadContentAsDecimal() ReadContentAsDecimal() ReadContentAsDecimal() ReadContentAsDecimal()

Reads the text content at the current position as a Decimal object.

(Inherited from XmlReader)
ReadContentAsDouble() ReadContentAsDouble() ReadContentAsDouble() ReadContentAsDouble()

Reads the text content at the current position as a double-precision floating-point number.

(Inherited from XmlReader)
ReadContentAsFloat() ReadContentAsFloat() ReadContentAsFloat() ReadContentAsFloat()

Reads the text content at the current position as a single-precision floating point number.

(Inherited from XmlReader)
ReadContentAsInt() ReadContentAsInt() ReadContentAsInt() ReadContentAsInt()

Reads the text content at the current position as a 32-bit signed integer.

(Inherited from XmlReader)
ReadContentAsLong() ReadContentAsLong() ReadContentAsLong() ReadContentAsLong()

Reads the text content at the current position as a 64-bit signed integer.

(Inherited from XmlReader)
ReadContentAsObject() ReadContentAsObject() ReadContentAsObject() ReadContentAsObject()

Reads the text content at the current position as an Object.

(Inherited from XmlReader)
ReadContentAsObjectAsync() ReadContentAsObjectAsync() ReadContentAsObjectAsync() ReadContentAsObjectAsync()

Asynchronously reads the text content at the current position as an Object.

(Inherited from XmlReader)
ReadContentAsString() ReadContentAsString() ReadContentAsString() ReadContentAsString()

Reads the text content at the current position as a String object.

(Inherited from XmlReader)
ReadContentAsStringAsync() ReadContentAsStringAsync() ReadContentAsStringAsync() ReadContentAsStringAsync()

Asynchronously reads the text content at the current position as a String object.

(Inherited from XmlReader)
ReadElementContentAs(Type, IXmlNamespaceResolver) ReadElementContentAs(Type, IXmlNamespaceResolver) ReadElementContentAs(Type, IXmlNamespaceResolver) ReadElementContentAs(Type, IXmlNamespaceResolver)

Reads the element content as the requested type.

(Inherited from XmlReader)
ReadElementContentAs(Type, IXmlNamespaceResolver, String, String) ReadElementContentAs(Type, IXmlNamespaceResolver, String, String) ReadElementContentAs(Type, IXmlNamespaceResolver, String, String) ReadElementContentAs(Type, IXmlNamespaceResolver, String, String)

Checks that the specified local name and namespace URI matches that of the current element, then reads the element content as the requested type.

(Inherited from XmlReader)
ReadElementContentAsAsync(Type, IXmlNamespaceResolver) ReadElementContentAsAsync(Type, IXmlNamespaceResolver) ReadElementContentAsAsync(Type, IXmlNamespaceResolver) ReadElementContentAsAsync(Type, IXmlNamespaceResolver)

Asynchronously reads the element content as the requested type.

(Inherited from XmlReader)
ReadElementContentAsBase64(Byte[], Int32, Int32) ReadElementContentAsBase64(Byte[], Int32, Int32) ReadElementContentAsBase64(Byte[], Int32, Int32) ReadElementContentAsBase64(Byte[], Int32, Int32)

Reads the element and decodes the Base64 content.

ReadElementContentAsBase64Async(Byte[], Int32, Int32) ReadElementContentAsBase64Async(Byte[], Int32, Int32) ReadElementContentAsBase64Async(Byte[], Int32, Int32) ReadElementContentAsBase64Async(Byte[], Int32, Int32)

Asynchronously reads the element and decodes the Base64 content.

(Inherited from XmlReader)
ReadElementContentAsBinHex(Byte[], Int32, Int32) ReadElementContentAsBinHex(Byte[], Int32, Int32) ReadElementContentAsBinHex(Byte[], Int32, Int32) ReadElementContentAsBinHex(Byte[], Int32, Int32)

Reads the element and decodes the BinHex content.

ReadElementContentAsBinHexAsync(Byte[], Int32, Int32) ReadElementContentAsBinHexAsync(Byte[], Int32, Int32) ReadElementContentAsBinHexAsync(Byte[], Int32, Int32) ReadElementContentAsBinHexAsync(Byte[], Int32, Int32)

Asynchronously reads the element and decodes the BinHex content.

(Inherited from XmlReader)
ReadElementContentAsBoolean() ReadElementContentAsBoolean() ReadElementContentAsBoolean() ReadElementContentAsBoolean()

Reads the current element and returns the contents as a Boolean object.

(Inherited from XmlReader)
ReadElementContentAsBoolean(String, String) ReadElementContentAsBoolean(String, String) ReadElementContentAsBoolean(String, String) ReadElementContentAsBoolean(String, String)

Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a Boolean object.

(Inherited from XmlReader)
ReadElementContentAsDateTime() ReadElementContentAsDateTime() ReadElementContentAsDateTime() ReadElementContentAsDateTime()

Reads the current element and returns the contents as a DateTime object.

(Inherited from XmlReader)
ReadElementContentAsDateTime(String, String) ReadElementContentAsDateTime(String, String) ReadElementContentAsDateTime(String, String) ReadElementContentAsDateTime(String, String)

Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a DateTime object.

(Inherited from XmlReader)
ReadElementContentAsDecimal() ReadElementContentAsDecimal() ReadElementContentAsDecimal() ReadElementContentAsDecimal()

Reads the current element and returns the contents as a Decimal object.

(Inherited from XmlReader)
ReadElementContentAsDecimal(String, String) ReadElementContentAsDecimal(String, String) ReadElementContentAsDecimal(String, String) ReadElementContentAsDecimal(String, String)

Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a Decimal object.

(Inherited from XmlReader)
ReadElementContentAsDouble() ReadElementContentAsDouble() ReadElementContentAsDouble() ReadElementContentAsDouble()

Reads the current element and returns the contents as a double-precision floating-point number.

(Inherited from XmlReader)
ReadElementContentAsDouble(String, String) ReadElementContentAsDouble(String, String) ReadElementContentAsDouble(String, String) ReadElementContentAsDouble(String, String)

Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a double-precision floating-point number.

(Inherited from XmlReader)
ReadElementContentAsFloat() ReadElementContentAsFloat() ReadElementContentAsFloat() ReadElementContentAsFloat()

Reads the current element and returns the contents as single-precision floating-point number.

(Inherited from XmlReader)
ReadElementContentAsFloat(String, String) ReadElementContentAsFloat(String, String) ReadElementContentAsFloat(String, String) ReadElementContentAsFloat(String, String)

Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a single-precision floating-point number.

(Inherited from XmlReader)
ReadElementContentAsInt() ReadElementContentAsInt() ReadElementContentAsInt() ReadElementContentAsInt()

Reads the current element and returns the contents as a 32-bit signed integer.

(Inherited from XmlReader)
ReadElementContentAsInt(String, String) ReadElementContentAsInt(String, String) ReadElementContentAsInt(String, String) ReadElementContentAsInt(String, String)

Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a 32-bit signed integer.

(Inherited from XmlReader)
ReadElementContentAsLong() ReadElementContentAsLong() ReadElementContentAsLong() ReadElementContentAsLong()

Reads the current element and returns the contents as a 64-bit signed integer.

(Inherited from XmlReader)
ReadElementContentAsLong(String, String) ReadElementContentAsLong(String, String) ReadElementContentAsLong(String, String) ReadElementContentAsLong(String, String)

Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a 64-bit signed integer.

(Inherited from XmlReader)
ReadElementContentAsObject() ReadElementContentAsObject() ReadElementContentAsObject() ReadElementContentAsObject()

Reads the current element and returns the contents as an Object.

(Inherited from XmlReader)
ReadElementContentAsObject(String, String) ReadElementContentAsObject(String, String) ReadElementContentAsObject(String, String) ReadElementContentAsObject(String, String)

Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as an Object.

(Inherited from XmlReader)
ReadElementContentAsObjectAsync() ReadElementContentAsObjectAsync() ReadElementContentAsObjectAsync() ReadElementContentAsObjectAsync()

Asynchronously reads the current element and returns the contents as an Object.

(Inherited from XmlReader)
ReadElementContentAsString() ReadElementContentAsString() ReadElementContentAsString() ReadElementContentAsString()

Reads the current element and returns the contents as a String object.

(Inherited from XmlReader)
ReadElementContentAsString(String, String) ReadElementContentAsString(String, String) ReadElementContentAsString(String, String) ReadElementContentAsString(String, String)

Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a String object.

(Inherited from XmlReader)
ReadElementContentAsStringAsync() ReadElementContentAsStringAsync() ReadElementContentAsStringAsync() ReadElementContentAsStringAsync()

Asynchronously reads the current element and returns the contents as a String object.

(Inherited from XmlReader)
ReadElementString() ReadElementString() ReadElementString() ReadElementString()

Reads a text-only element. However, we recommend that you use the ReadElementContentAsString() method instead, because it provides a more straightforward way to handle this operation.

(Inherited from XmlReader)
ReadElementString(String) ReadElementString(String) ReadElementString(String) ReadElementString(String)

Checks that the Name property of the element found matches the given string before reading a text-only element. However, we recommend that you use the ReadElementContentAsString() method instead, because it provides a more straightforward way to handle this operation.

(Inherited from XmlReader)
ReadElementString(String, String) ReadElementString(String, String) ReadElementString(String, String) ReadElementString(String, String)

Checks that the LocalName and NamespaceURI properties of the element found matches the given strings before reading a text-only element. However, we recommend that you use the ReadElementContentAsString(String, String) method instead, because it provides a more straightforward way to handle this operation.

(Inherited from XmlReader)
ReadEndElement() ReadEndElement() ReadEndElement() ReadEndElement()

Checks that the current content node is an end tag and advances the reader to the next node.

(Inherited from XmlReader)
ReadInnerXml() ReadInnerXml() ReadInnerXml() ReadInnerXml()

When overridden in a derived class, reads all the content, including markup, as a string.

(Inherited from XmlReader)
ReadInnerXmlAsync() ReadInnerXmlAsync() ReadInnerXmlAsync() ReadInnerXmlAsync()

Asynchronously reads all the content, including markup, as a string.

(Inherited from XmlReader)
ReadOuterXml() ReadOuterXml() ReadOuterXml() ReadOuterXml()

When overridden in a derived class, reads the content, including markup, representing this node and all its children.

(Inherited from XmlReader)
ReadOuterXmlAsync() ReadOuterXmlAsync() ReadOuterXmlAsync() ReadOuterXmlAsync()

Asynchronously reads the content, including markup, representing this node and all its children.

(Inherited from XmlReader)
ReadStartElement() ReadStartElement() ReadStartElement() ReadStartElement()

Checks that the current node is an element and advances the reader to the next node.

(Inherited from XmlReader)
ReadStartElement(String) ReadStartElement(String) ReadStartElement(String) ReadStartElement(String)

Checks that the current content node is an element with the given Name and advances the reader to the next node.

(Inherited from XmlReader)
ReadStartElement(String, String) ReadStartElement(String, String) ReadStartElement(String, String) ReadStartElement(String, String)

Checks that the current content node is an element with the given LocalName and NamespaceURI and advances the reader to the next node.

(Inherited from XmlReader)
ReadString() ReadString() ReadString() ReadString()

Reads the contents of an element or text node as a string.

ReadSubtree() ReadSubtree() ReadSubtree() ReadSubtree()

Returns a new XmlReader instance that can be used to read the current node, and all its descendants.

(Inherited from XmlReader)
ReadToDescendant(String) ReadToDescendant(String) ReadToDescendant(String) ReadToDescendant(String)

Advances the XmlReader to the next descendant element with the specified qualified name.

(Inherited from XmlReader)
ReadToDescendant(String, String) ReadToDescendant(String, String) ReadToDescendant(String, String) ReadToDescendant(String, String)

Advances the XmlReader to the next descendant element with the specified local name and namespace URI.

(Inherited from XmlReader)
ReadToFollowing(String) ReadToFollowing(String) ReadToFollowing(String) ReadToFollowing(String)

Reads until an element with the specified qualified name is found.

(Inherited from XmlReader)
ReadToFollowing(String, String) ReadToFollowing(String, String) ReadToFollowing(String, String) ReadToFollowing(String, String)

Reads until an element with the specified local name and namespace URI is found.

(Inherited from XmlReader)
ReadToNextSibling(String) ReadToNextSibling(String) ReadToNextSibling(String) ReadToNextSibling(String)

Advances the XmlReader to the next sibling element with the specified qualified name.

(Inherited from XmlReader)
ReadToNextSibling(String, String) ReadToNextSibling(String, String) ReadToNextSibling(String, String) ReadToNextSibling(String, String)

Advances the XmlReader to the next sibling element with the specified local name and namespace URI.

(Inherited from XmlReader)
ReadValueChunk(Char[], Int32, Int32) ReadValueChunk(Char[], Int32, Int32) ReadValueChunk(Char[], Int32, Int32) ReadValueChunk(Char[], Int32, Int32)

Reads large streams of text embedded in an XML document.

(Inherited from XmlReader)
ReadValueChunkAsync(Char[], Int32, Int32) ReadValueChunkAsync(Char[], Int32, Int32) ReadValueChunkAsync(Char[], Int32, Int32) ReadValueChunkAsync(Char[], Int32, Int32)

Asynchronously reads large streams of text embedded in an XML document.

(Inherited from XmlReader)
ResolveEntity() ResolveEntity() ResolveEntity() ResolveEntity()

Resolves the entity reference for EntityReference nodes.

Skip() Skip() Skip() Skip()

Skips the children of the current node.

SkipAsync() SkipAsync() SkipAsync() SkipAsync()

Asynchronously skips the children of the current node.

(Inherited from XmlReader)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

IDisposable.Dispose() IDisposable.Dispose() IDisposable.Dispose() IDisposable.Dispose()

For a description of this member, see Dispose().

(Inherited from XmlReader)
IXmlNamespaceResolver.GetNamespacesInScope(XmlNamespaceScope) IXmlNamespaceResolver.GetNamespacesInScope(XmlNamespaceScope) IXmlNamespaceResolver.GetNamespacesInScope(XmlNamespaceScope) IXmlNamespaceResolver.GetNamespacesInScope(XmlNamespaceScope)

For a description of this member, see GetNamespacesInScope(XmlNamespaceScope).

IXmlNamespaceResolver.LookupNamespace(String) IXmlNamespaceResolver.LookupNamespace(String) IXmlNamespaceResolver.LookupNamespace(String) IXmlNamespaceResolver.LookupNamespace(String)

For a description of this member, see LookupNamespace(String).

IXmlNamespaceResolver.LookupPrefix(String) IXmlNamespaceResolver.LookupPrefix(String) IXmlNamespaceResolver.LookupPrefix(String) IXmlNamespaceResolver.LookupPrefix(String)

For a description of this member, see LookupPrefix(String).

Applies to