<PackageReference Include="System.Xml.ReaderWriter" Version="4.0.11-beta-23409" />

XmlReader

public abstract class XmlReader : IDisposable
Represents a reader that provides fast, noncached, forward-only access to XML data.To browse the .NET Framework source code for this type, see the Reference Source.
public abstract int AttributeCount { get; }

When overridden in a derived class, gets the number of attributes on the current node.

public abstract string BaseURI { get; }

When overridden in a derived class, gets the base URI of the current node.

public virtual bool CanReadBinaryContent { get; }

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

public virtual bool CanReadValueChunk { get; }

Gets a value indicating whether the XmlReader implements the ReadValueChunk method.

public virtual bool CanResolveEntity { get; }

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

public abstract int Depth { get; }

When overridden in a derived class, gets the depth of the current node in the XML document.

public abstract bool EOF { get; }

When overridden in a derived class, gets a value indicating whether the reader is positioned at the end of the stream.

public virtual bool HasAttributes { get; }

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

public virtual bool HasValue { get; }

When overridden in a derived class, gets a value indicating whether the current node can have a Value.

public virtual bool IsDefault { get; }

When overridden in a derived class, gets a value indicating whether the current node is an attribute that was generated from the default value defined in the DTD or schema.

public abstract bool IsEmptyElement { get; }

When overridden in a derived class, gets a value indicating whether the current node is an empty element (for example, <MyElement/>).

public virtual string this[int i] { get; }

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

public virtual string this[string name] { get; }

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

public virtual string this[string name, string namespaceURI] { get; }

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

public abstract string LocalName { get; }

When overridden in a derived class, gets the local name of the current node.

public virtual string Name { get; }

When overridden in a derived class, gets the qualified name of the current node.

public abstract string NamespaceURI { get; }

When overridden in a derived class, gets the namespace URI (as defined in the W3C Namespace specification) of the node on which the reader is positioned.

public abstract XmlNameTable NameTable { get; }

When overridden in a derived class, gets the XmlNameTable associated with this implementation.

public abstract XmlNodeType NodeType { get; }

When overridden in a derived class, gets the type of the current node.

public abstract string Prefix { get; }

When overridden in a derived class, gets the namespace prefix associated with the current node.

public abstract ReadState ReadState { get; }

When overridden in a derived class, gets the state of the reader.

public virtual XmlReaderSettings Settings { get; }

Gets the XmlReaderSettings object used to create this XmlReader instance.

public abstract string Value { get; }

When overridden in a derived class, gets the text value of the current node.

public virtual Type ValueType { get; }

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

public virtual string XmlLang { get; }

When overridden in a derived class, gets the current xml:lang scope.

public virtual XmlSpace XmlSpace { get; }

When overridden in a derived class, gets the current xml:space scope.

protected XmlReader()

Initializes a new instance of the XmlReader class.

public static XmlReader Create(string inputUri)

Creates a new XmlReader instance with specified URI.

public static XmlReader Create(string inputUri, XmlReaderSettings settings)

Creates a new XmlReader instance by using the specified URI and settings.

public static XmlReader Create(Stream input)

Creates a new XmlReader instance using the specified stream with default settings.

public static XmlReader Create(Stream input, XmlReaderSettings settings)

Creates a new XmlReader instance with the specified stream and settings.

public static XmlReader Create(Stream input, XmlReaderSettings settings, XmlParserContext inputContext)

Creates a new XmlReader instance using the specified stream, settings, and context information for parsing.

public static XmlReader Create(TextReader input)

Creates a new XmlReader instance by using the specified text reader.

public static XmlReader Create(TextReader input, XmlReaderSettings settings)

Creates a new XmlReader instance by using the specified text reader and settings.

public static XmlReader Create(TextReader input, XmlReaderSettings settings, XmlParserContext inputContext)

Creates a new XmlReader instance by using the specified text reader, settings, and context information for parsing.

public static XmlReader Create(XmlReader reader, XmlReaderSettings settings)

Creates a new XmlReader instance by using the specified XML reader and settings.

public static bool IsName(string str)

Returns a value indicating whether the string argument is a valid XML name.

public static bool IsNameToken(string str)

Returns a value indicating whether or not the string argument is a valid XML name token.

public void Dispose()

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

protected virtual void Dispose(bool disposing)

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

public abstract string GetAttribute(string name)

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

public abstract string GetAttribute(string name, string namespaceURI)

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

public abstract string GetAttribute(int i)

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

public virtual Task<string> GetValueAsync()

Asynchronously gets the value of the current node.

public virtual bool IsStartElement()

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

public virtual bool IsStartElement(string name)

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.

public virtual bool IsStartElement(string localname, string ns)

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.

public abstract string LookupNamespace(string prefix)

When overridden in a derived class, resolves a namespace prefix in the current element's scope.

public abstract bool MoveToAttribute(string name)

When overridden in a derived class, moves to the attribute with the specified Name.

public abstract bool MoveToAttribute(string name, string ns)

When overridden in a derived class, moves to the attribute with the specified LocalName and NamespaceURI.

public virtual void MoveToAttribute(int i)

When overridden in a derived class, moves to the attribute with the specified index.

public virtual XmlNodeType 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.

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.

public abstract bool MoveToElement()

When overridden in a derived class, moves to the element that contains the current attribute node.

public abstract bool MoveToFirstAttribute()

When overridden in a derived class, moves to the first attribute.

public abstract bool MoveToNextAttribute()

When overridden in a derived class, moves to the next attribute.

public abstract bool Read()

When overridden in a derived class, reads the next node from the stream.

public virtual Task<bool> ReadAsync()

Asynchronously reads the next node from the stream.

public abstract bool ReadAttributeValue()

When overridden in a derived class, parses the attribute value into one or more Text, EntityReference, or EndEntity nodes.

public virtual object ReadContentAs(Type returnType, IXmlNamespaceResolver namespaceResolver)

Reads the content as an object of the type specified.

public virtual Task<object> ReadContentAsAsync(Type returnType, IXmlNamespaceResolver namespaceResolver)

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

public virtual int ReadContentAsBase64(byte[] buffer, int index, int count)

Reads the content and returns the Base64 decoded binary bytes.

public virtual Task<int> ReadContentAsBase64Async(byte[] buffer, int index, int count)

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

public virtual int ReadContentAsBinHex(byte[] buffer, int index, int count)

Reads the content and returns the BinHex decoded binary bytes.

public virtual Task<int> ReadContentAsBinHexAsync(byte[] buffer, int index, int count)

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

public virtual bool ReadContentAsBoolean()

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

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

public virtual decimal ReadContentAsDecimal()

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

public virtual double ReadContentAsDouble()

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

public virtual float ReadContentAsFloat()

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

public virtual int ReadContentAsInt()

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

public virtual long ReadContentAsLong()

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

public virtual object ReadContentAsObject()

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

public virtual Task<object> ReadContentAsObjectAsync()

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

public virtual string ReadContentAsString()

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

public virtual Task<string> ReadContentAsStringAsync()

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

public virtual object ReadElementContentAs(Type returnType, IXmlNamespaceResolver namespaceResolver)

Reads the element content as the requested type.

public virtual object ReadElementContentAs(Type returnType, IXmlNamespaceResolver namespaceResolver, string localName, string namespaceURI)

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

public virtual Task<object> ReadElementContentAsAsync(Type returnType, IXmlNamespaceResolver namespaceResolver)

Asynchronously reads the element content as the requested type.

public virtual int ReadElementContentAsBase64(byte[] buffer, int index, int count)

Reads the element and decodes the Base64 content.

public virtual Task<int> ReadElementContentAsBase64Async(byte[] buffer, int index, int count)

Asynchronously reads the element and decodes the Base64 content.

public virtual int ReadElementContentAsBinHex(byte[] buffer, int index, int count)

Reads the element and decodes the BinHex content.

public virtual Task<int> ReadElementContentAsBinHexAsync(byte[] buffer, int index, int count)

Asynchronously reads the element and decodes the BinHex content.

public virtual bool ReadElementContentAsBoolean()

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

public virtual bool ReadElementContentAsBoolean(string localName, string namespaceURI)

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.

public virtual decimal ReadElementContentAsDecimal()

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

public virtual decimal ReadElementContentAsDecimal(string localName, string namespaceURI)

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.

public virtual double ReadElementContentAsDouble()

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

public virtual double ReadElementContentAsDouble(string localName, string namespaceURI)

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.

public virtual float ReadElementContentAsFloat()

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

public virtual float ReadElementContentAsFloat(string localName, string namespaceURI)

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.

public virtual int ReadElementContentAsInt()

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

public virtual int ReadElementContentAsInt(string localName, string namespaceURI)

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.

public virtual long ReadElementContentAsLong()

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

public virtual long ReadElementContentAsLong(string localName, string namespaceURI)

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.

public virtual object ReadElementContentAsObject()

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

public virtual object ReadElementContentAsObject(string localName, string namespaceURI)

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.

public virtual Task<object> ReadElementContentAsObjectAsync()

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

public virtual string ReadElementContentAsString()

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

public virtual string ReadElementContentAsString(string localName, string namespaceURI)

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.

public virtual Task<string> ReadElementContentAsStringAsync()

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

public virtual void ReadEndElement()

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

public virtual string ReadInnerXml()

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

public virtual Task<string> ReadInnerXmlAsync()

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

public virtual string ReadOuterXml()

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

public virtual Task<string> ReadOuterXmlAsync()

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

public virtual void ReadStartElement()

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

public virtual void ReadStartElement(string name)

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

public virtual void ReadStartElement(string localname, string ns)

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

public virtual XmlReader ReadSubtree()

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

public virtual bool ReadToDescendant(string name)

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

public virtual bool ReadToDescendant(string localName, string namespaceURI)

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

public virtual bool ReadToFollowing(string name)

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

public virtual bool ReadToFollowing(string localName, string namespaceURI)

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

public virtual bool ReadToNextSibling(string name)

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

public virtual bool ReadToNextSibling(string localName, string namespaceURI)

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

public virtual int ReadValueChunk(char[] buffer, int index, int count)

Reads large streams of text embedded in an XML document.

public virtual Task<int> ReadValueChunkAsync(char[] buffer, int index, int count)

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

public abstract void ResolveEntity()

When overridden in a derived class, resolves the entity reference for EntityReference nodes.

public virtual void Skip()

Skips the children of the current node.

public virtual Task SkipAsync()

Asynchronously skips the children of the current node.