Breyta

Deila með


XmlTextReader Class

Definition

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

Starting with the .NET Framework 2.0, we recommend that you use the XmlReader class instead.

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

Remarks

For more information about this API, see Supplemental API remarks for XmlTextReader.

Notes to Inheritors

This class has an inheritance demand. Full trust is required to inherit from XmlTextReader.

Constructors

XmlTextReader()

Initializes a new instance of the XmlTextReader.

XmlTextReader(Stream, XmlNameTable)

Initializes a new instance of the XmlTextReader class with the specified stream and XmlNameTable.

XmlTextReader(Stream, XmlNodeType, XmlParserContext)

Initializes a new instance of the XmlTextReader class with the specified stream, XmlNodeType, and XmlParserContext.

XmlTextReader(Stream)

Initializes a new instance of the XmlTextReader class with the specified stream.

XmlTextReader(String, Stream, XmlNameTable)

Initializes a new instance of the XmlTextReader class with the specified URL, stream and XmlNameTable.

XmlTextReader(String, Stream)

Initializes a new instance of the XmlTextReader class with the specified URL and stream.

XmlTextReader(String, TextReader, XmlNameTable)

Initializes a new instance of the XmlTextReader class with the specified URL, TextReader and XmlNameTable.

XmlTextReader(String, TextReader)

Initializes a new instance of the XmlTextReader class with the specified URL and TextReader.

XmlTextReader(String, XmlNameTable)

Initializes a new instance of the XmlTextReader class with the specified file and XmlNameTable.

XmlTextReader(String, XmlNodeType, XmlParserContext)

Initializes a new instance of the XmlTextReader class with the specified string, XmlNodeType, and XmlParserContext.

XmlTextReader(String)

Initializes a new instance of the XmlTextReader class with the specified file.

XmlTextReader(TextReader, XmlNameTable)

Initializes a new instance of the XmlTextReader class with the specified TextReader and XmlNameTable.

XmlTextReader(TextReader)

Initializes a new instance of the XmlTextReader class with the specified TextReader.

XmlTextReader(XmlNameTable)

Initializes a new instance of the XmlTextReader class with the specified XmlNameTable.

Properties

AttributeCount

Gets the number of attributes on the current node.

BaseURI

Gets the base URI of the current node.

CanReadBinaryContent

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

CanReadBinaryContent

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

(Inherited from XmlReader)
CanReadValueChunk

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

CanReadValueChunk

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

(Inherited from XmlReader)
CanResolveEntity

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

CanResolveEntity

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

(Inherited from XmlReader)
Depth

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

DtdProcessing

Gets or sets the DtdProcessing enumeration.

Encoding

Gets the encoding of the document.

EntityHandling

Gets or sets a value that specifies how the reader handles entities.

EOF

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

HasAttributes

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

(Inherited from XmlReader)
HasValue

Gets a value indicating whether the current node can have a Value other than String.Empty.

IsDefault

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

IsEmptyElement

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

Item[Int32]

Gets the value of the attribute with the specified index.

Item[Int32]

When overridden in a derived class, gets the value of the attribute with the specified index.

(Inherited from XmlReader)
Item[String, String]

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

Item[String, String]

When overridden in a derived class, gets the value of the attribute with the specified LocalName and NamespaceURI.

(Inherited from XmlReader)
Item[String]

Gets the value of the attribute with the specified name.

Item[String]

When overridden in a derived class, gets the value of the attribute with the specified Name.

(Inherited from XmlReader)
LineNumber

Gets the current line number.

LinePosition

Gets the current line position.

LocalName

Gets the local name of the current node.

Name

Gets the qualified name of the current node.

Namespaces

Gets or sets a value indicating whether to do namespace support.

NamespaceURI

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

NameTable

Gets the XmlNameTable associated with this implementation.

NodeType

Gets the type of the current node.

Normalization

Gets or sets a value indicating whether to normalize white space and attribute values.

Prefix

Gets the namespace prefix associated with the current node.

ProhibitDtd
Obsolete.
Obsolete.

Gets or sets a value indicating whether to allow DTD processing. This property is obsolete. Use DtdProcessing instead.

QuoteChar

Gets the quotation mark character used to enclose the value of an attribute node.

ReadState

Gets the state of the reader.

SchemaInfo

Gets the schema information that has been assigned to the current node as a result of schema validation.

(Inherited from XmlReader)
Settings

Gets the XmlReaderSettings object used to create this XmlTextReader instance.

Settings

Gets the XmlReaderSettings object used to create this XmlReader instance.

(Inherited from XmlReader)
Value

Gets the text value of the current node.

ValueType

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

(Inherited from XmlReader)
WhitespaceHandling

Gets or sets a value that specifies how white space is handled.

XmlLang

Gets the current xml:lang scope.

XmlResolver

Sets the XmlResolver used for resolving DTD references.

XmlSpace

Gets the current xml:space scope.

Methods

Close()

Changes the ReadState to Closed.

Dispose()

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

(Inherited from XmlReader)
Dispose(Boolean)

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

(Inherited from XmlReader)
Equals(Object)

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

(Inherited from Object)
GetAttribute(Int32)

Gets the value of the attribute with the specified index.

GetAttribute(String, String)

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

GetAttribute(String)

Gets the value of the attribute with the specified name.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetNamespacesInScope(XmlNamespaceScope)

Gets a collection that contains all namespaces currently in-scope.

GetRemainder()

Gets the remainder of the buffered XML.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
GetValueAsync()

Asynchronously gets the value of the current node.

(Inherited from XmlReader)
HasLineInfo()

Gets a value indicating whether the class can return line information.

IsStartElement()

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

(Inherited from XmlReader)
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)
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)
LookupNamespace(String)

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

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
MoveToAttribute(Int32)

Moves to the attribute with the specified index.

MoveToAttribute(String, String)

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

MoveToAttribute(String)

Moves to the attribute with the specified name.

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()

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()

Moves to the element that contains the current attribute node.

MoveToFirstAttribute()

Moves to the first attribute.

MoveToNextAttribute()

Moves to the next attribute.

Read()

Reads the next node from the stream.

ReadAsync()

Asynchronously reads the next node from the stream.

(Inherited from XmlReader)
ReadAttributeValue()

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

ReadBase64(Byte[], Int32, Int32)

Decodes Base64 and returns the decoded binary bytes.

ReadBinHex(Byte[], Int32, Int32)

Decodes BinHex and returns the decoded binary bytes.

ReadChars(Char[], Int32, Int32)

Reads the text contents of an element into a character buffer. This method is designed to read large streams of embedded text by calling it successively.

ReadContentAs(Type, IXmlNamespaceResolver)

Reads the content as an object of the type specified.

(Inherited from XmlReader)
ReadContentAsAsync(Type, IXmlNamespaceResolver)

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

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

Reads the content and returns the Base64 decoded binary bytes.

ReadContentAsBase64(Byte[], Int32, Int32)

Reads the content and returns the Base64 decoded binary bytes.

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

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

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

Reads the content and returns the BinHex decoded binary bytes.

ReadContentAsBinHex(Byte[], Int32, Int32)

Reads the content and returns the BinHex decoded binary bytes.

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

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

(Inherited from XmlReader)
ReadContentAsBoolean()

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

(Inherited from XmlReader)
ReadContentAsDateTime()

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

(Inherited from XmlReader)
ReadContentAsDateTimeOffset()

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

(Inherited from XmlReader)
ReadContentAsDecimal()

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

(Inherited from XmlReader)
ReadContentAsDouble()

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

(Inherited from XmlReader)
ReadContentAsFloat()

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

(Inherited from XmlReader)
ReadContentAsInt()

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

(Inherited from XmlReader)
ReadContentAsLong()

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

(Inherited from XmlReader)
ReadContentAsObject()

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

(Inherited from XmlReader)
ReadContentAsObjectAsync()

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

(Inherited from XmlReader)
ReadContentAsString()

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

(Inherited from XmlReader)
ReadContentAsStringAsync()

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

(Inherited from XmlReader)
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)
ReadElementContentAs(Type, IXmlNamespaceResolver)

Reads the element content as the requested type.

(Inherited from XmlReader)
ReadElementContentAsAsync(Type, IXmlNamespaceResolver)

Asynchronously reads the element content as the requested type.

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

Reads the element and decodes the Base64 content.

ReadElementContentAsBase64(Byte[], Int32, Int32)

Reads the element and decodes the Base64 content.

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

Asynchronously reads the element and decodes the Base64 content.

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

Reads the element and decodes the BinHex content.

ReadElementContentAsBinHex(Byte[], Int32, Int32)

Reads the element and decodes the BinHex content.

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

Asynchronously reads the element and decodes the BinHex content.

(Inherited from XmlReader)
ReadElementContentAsBoolean()

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

(Inherited from XmlReader)
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()

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

(Inherited from XmlReader)
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()

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

(Inherited from XmlReader)
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()

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

(Inherited from XmlReader)
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()

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

(Inherited from XmlReader)
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()

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

(Inherited from XmlReader)
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()

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

(Inherited from XmlReader)
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()

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

(Inherited from XmlReader)
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()

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

(Inherited from XmlReader)
ReadElementContentAsString()

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

(Inherited from XmlReader)
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()

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

(Inherited from XmlReader)
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, 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)
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)
ReadEndElement()

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

(Inherited from XmlReader)
ReadInnerXml()

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

(Inherited from XmlReader)
ReadInnerXmlAsync()

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

(Inherited from XmlReader)
ReadOuterXml()

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

(Inherited from XmlReader)
ReadOuterXmlAsync()

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

(Inherited from XmlReader)
ReadStartElement()

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

(Inherited from XmlReader)
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)
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)
ReadString()

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

ReadString()

When overridden in a derived class, reads the contents of an element or text node as a string. However, we recommend that you use the ReadElementContentAsString method instead, because it provides a more straightforward way to handle this operation.

(Inherited from XmlReader)
ReadSubtree()

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

(Inherited from XmlReader)
ReadToDescendant(String, String)

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

(Inherited from XmlReader)
ReadToDescendant(String)

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

(Inherited from XmlReader)
ReadToFollowing(String, String)

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

(Inherited from XmlReader)
ReadToFollowing(String)

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

(Inherited from XmlReader)
ReadToNextSibling(String, String)

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

(Inherited from XmlReader)
ReadToNextSibling(String)

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

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

Reads large streams of text embedded in an XML document.

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

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

(Inherited from XmlReader)
ResetState()

Resets the state of the reader to ReadState.Initial.

ResolveEntity()

Resolves the entity reference for EntityReference nodes.

Skip()

Skips the children of the current node.

Skip()

Skips the children of the current node.

(Inherited from XmlReader)
SkipAsync()

Asynchronously skips the children of the current node.

(Inherited from XmlReader)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

IDisposable.Dispose()

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

(Inherited from XmlReader)
IXmlLineInfo.HasLineInfo()

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

IXmlNamespaceResolver.GetNamespacesInScope(XmlNamespaceScope)

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

IXmlNamespaceResolver.LookupNamespace(String)

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

IXmlNamespaceResolver.LookupPrefix(String)

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

Applies to

See also