XML System.Xml [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 4.0.0.0 All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe. System.Object System.IDisposable provides forward-only, read-only access to a stream of XML data. The class conforms to the W3C Extensible Markup Language (XML) 1.0 and the Namespaces in XML recommendations. 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 reflect the value of the current node. Although the .NET Framework includes concrete implementations of the class, such as the , , and the classes, in the 2.0 release the recommended practice is to create instances using the method. For more information, see Creating XML Readers. throws an on XML parse errors. After an exception is thrown, the state of the reader is not predictable. For example, the reported node type may be different from the actual node type of the current node. Use the property to check whether the reader is in error state. For further discussion on the class, see Reading XML with the XmlReader. The following methods can be used with asynchronous method calls: Some synchronous methods have asynchronous counterparts that include "Async" at the end of the method name. For example, the asynchronous equivalents for the ReadContentAsXxx and ReadElementContentAsXxx methods are: and and and The following sections describe asynchronous usage for methods that don't have asynchronous counterparts.

ReadStartElement method

public static async Task ReadStartElementAsync(this XmlReader reader, string localname, string ns) { if (await reader.MoveToContentAsync() != XmlNodeType.Element) { throw new InvalidOperationException( reader.NodeType.ToString() + " is an invalid XmlNodeType"); } if (reader.LocalName == localname && reader.NamespaceURI == ns) { await reader.ReadAsync(); } else { throw new InvalidOperationException("localName or namespace doesn’t match"); } }

ReadEndElement method

Extension function: public static async Task ReadEndElementAsync(this XmlReader reader) { if (await reader.MoveToContentAsync() != XmlNodeType.EndElement) { throw new InvalidOperationException(); } await reader.ReadAsync(); }

ReadToNextSibling method

public static async Task<bool> ReadToNextSiblingAsync(this XmlReader reader, string localName, string namespaceURI) { if (localName == null || localName.Length == 0) { throw new ArgumentException ("localName is empty or null"); } if (namespaceURI == null) { throw new ArgumentNullException("namespaceURI"); } // atomize local name and namespace localName = reader.NameTable.Add(localName); namespaceURI = reader.NameTable.Add(namespaceURI); // find the next sibling XmlNodeType nt; do { await reader.SkipAsync(); if (reader.ReadState != ReadState.Interactive) break; nt = reader.NodeType; if (nt == XmlNodeType.Element && ((object)localName == (object)reader.LocalName) && ((object)namespaceURI == (object)reader.NamespaceURI)) { return true; } }while(nt != XmlNodeType.EndElement && !reader.EOF); return false; }

ReadToFollowing method

public static async Task<bool> ReadToFollowingAsync(this XmlReader reader, string localName, string namespaceURI) { if (localName == null || localName.Length == 0) { throw new ArgumentException( "localName is empty or null"); } if (namespaceURI == null) { throw new ArgumentNullException( "namespaceURI"); } // atomize local name and namespace localName = reader.NameTable.Add(localName); namespaceURI = reader.NameTable.Add(namespaceURI); // find element with that name while (await reader.ReadAsync()) { if (reader.NodeType == XmlNodeType.Element && ((object)localName == (object)reader.LocalName) && ((object)namespaceURI == (object)reader.NamespaceURI)) { return true; } } return false; }

ReadToDescendant method

public static async Task<bool> ReadToDescendantAsync(this XmlReader reader, string localName, string namespaceURI) { if (localName == null || localName.Length == 0) { throw new ArgumentException("localName is empty or null"); } if (namespaceURI == null) { throw new ArgumentNullException("namespaceURI"); } // save the element or root depth int parentDepth = reader.Depth; if (reader.NodeType != XmlNodeType.Element) { // adjust the depth if we are on root node if (reader.ReadState == ReadState.Initial) { parentDepth--; } else { return false; } } else if (reader.IsEmptyElement) { return false; } // atomize local name and namespace localName = reader.NameTable.Add(localName); namespaceURI = reader.NameTable.Add(namespaceURI); // find the descendant while (await reader.ReadAsync() && reader.Depth > parentDepth) { if (reader.NodeType == XmlNodeType.Element && ((object)localName == (object)reader.LocalName) && ((object)namespaceURI == (object)reader.NamespaceURI)) { return true; } } return false; }

Security considerations

The following items are things to consider when working with the class. Exceptions thrown from the can disclose path information that you do not want bubbled up to the application. Your applications must catch exceptions and process them appropriately. Do not enable DTD processing if you are concerned about denial of service issues or if you are dealing with untrusted sources. DTD processing is disabled by default for objects created by the method. If you have DTD processing enabled, you can use the to restrict the resources that the can access. You can also design your application so that the XML processing is memory and time constrained. For example, configure time-out limits in your ASP.NET application. XML data can include references to external resources such as a schema file. By default external resources are resolved using an object with no user credentials. You can secure this further by doing one of the following: Restrict the resources that the can access by setting the property to an object. Do not allow the to open any external resources by setting the property to null. The and validation flags of an object are not set by default. This helps to protect the against schema-based attacks when it is processing XML data from an untrusted source. When these flags are set, the of the object is used to resolve schema locations encountered in the instance document in the . If the property is set to null, schema locations are not resolved even if the and validation flags are set. Schemas added during validation add new types and can change the validation outcome of the document being validated. As a result, external schemas should only be resolved from trusted sources. We recommend disabling the flag (enabled by default) when validating, untrusted, large XML documents in high availability scenarios against a schema with identity constraints over a large part of the document. XML data can contain a large number of attributes, namespace declarations, nested elements and so on that require a substantial amount of time to process. To limit the size of the input that is sent to the , you can: Limit the size of the document by setting the property. Limit the number of characters that result from expanding entities by setting the property. Create a custom IStream implementation and supply it the . The method can be used to handle large streams of data. This method reads a small number of characters at a time instead of allocating a single string for the whole value. When reading an XML document with a large number of unique local names, namespaces, or prefixes, a problem can occur. If you are using a class that derives from , and you call either the , , or property for each item, the returned string is added to a . The collection held by the never decreases in size, creating a virtual "memory leak" of the string handles. One mitigation for this is to derive from the class and enforce a maximum size quota. (There is no way to prevent the use of a , or to switch the when it is full). Another mitigation is to avoid using the properties mentioned and instead use the method with the method where possible; those methods do not return strings and thus avoid the problem of overfilling the collection. objects can contain sensitive information such as user credentials. An untrusted component could use the object and its user credentials to create objects to read data. You should be careful when caching objects, or when passing the object from one component to another. Do not accept supporting components, such as , , and objects, from an untrusted source.
Represents a reader that provides fast, noncached, forward-only access to XML data.
Constructor 1.0.5000.0 2.0.0.0 4.0.0.0 This constructor is called by derived class constructors to initialize state in this type. Initializes a new instance of the XmlReader class. 0 Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.Int32 A containing the number of attributes on the current node, or zero if the current node does not support attributes. This property is relevant to Element, DocumentType and XmlDeclaration nodes only. (Other node types do not have attributes.) When overridden in a derived class, gets the number of attributes on the current node. 0 Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.String The base URI of the current node. A networked XML document is comprised of chunks of data aggregated using various W3C standard inclusion mechanisms and therefore contains nodes that come from different places. DTD entities are an example of this, but this is not limited to DTDs. The base URI tells you where these nodes came from. If there is no base URI for the nodes being returned (for example, they were parsed from an in-memory string), String.Empty is returned. When overridden in a derived class, gets the base URI of the current node. 0 Property 2.0.0.0 4.0.0.0 System.Boolean To be added. The binary content read methods include the , , , and methods. If this property returns false a is returned when any of the binary read methods is called. All Microsoft .NET Framework implementations of the class return true for this property. Gets a value indicating whether the implements the binary content read methods. Property 2.0.0.0 4.0.0.0 System.Boolean To be added. Text parsing objects that were created from the static method always return true. All other Microsoft .NET Framework implementations of the class, including the class, return false. If this property returns false a is returned when the method is called. Gets a value indicating whether the implements the method. Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.Boolean A equal to . This property always returns false for implementations of that do not support DTD information. In this case, calling throws an exception. Gets a value indicating whether this reader can parse and resolve entities. 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.Void This method also releases any resources held during reading. If has already been called, no action is performed. When overridden in a derived class, changes the to Closed. 0 Method 2.0.0.0 4.0.0.0 System.Xml.XmlReader An object with default settings is used to create the reader. If you wish to specify the features to support on the created reader, use the overload that takes an object as one of its arguments, and pass in an object with the correct settings. A default with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on. If the external resource is located on a network resource that requires authentication, specify an with the necessary credentials using the property. The created object expands entity references and performs XML normalization of new line characters. Creates a new instance using the specified stream. An object used to read the data contained in the stream. The stream containing the XML data. Method 2.0.0.0 4.0.0.0 System.Xml.XmlReader An object with default settings is used to create the reader. If you wish to specify the features to support on the created reader, use the overload that takes an object as one of its arguments, and pass in an object with the correct settings. A default with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on. If the external resource is located on a network resource that requires authentication, specify an with the necessary credentials using the property. The created object expands entity references and performs XML normalization of new line characters. Creates a new instance with the specified . An object to read the XML data. The from which to read the XML data. Because a returns a stream of Unicode characters, the encoding specified in the XML declaration is not used by the to decode the data stream. Method 2.0.0.0 4.0.0.0 System.Xml.XmlReader An object with default settings is used to create the reader. If you wish to specify the features to support on the created reader, use the overload that takes an object as one of its arguments, and pass in an object with the correct settings. A default with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on. If the external resource is located on a network resource that requires authentication, specify an with the necessary credentials using the property. The created object expands entity references and performs XML normalization of new line characters. Creates a new instance with specified URI. An object to read the XML data. The URI for the file containing the XML data. The class is used to convert the path to a canonical data representation. Method 2.0.0.0 4.0.0.0 System.Xml.XmlReader By default an with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on. If the external resource is located on a network resource that requires authentication, use the property to specify an with the necessary credentials. You can use one of the following methods to control which resources the can access: Restrict the resources that the can access by setting the property to an object. -or- Do not allow the to open any external resources by setting the property to null. The created object expands entity references and performs XML normalization of new line characters. Creates a new instance with the specified stream and object. An object to read the XML data. The stream containing the XML data. The object used to configure the new instance. This value can be null. Method 2.0.0.0 4.0.0.0 System.Xml.XmlReader By default an with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on. If the external resource is located on a network resource that requires authentication, use the property to specify an with the necessary credentials. You can use one of the following methods to control which resources the can access: Restrict the resources that the can access by setting the property to an object. -or- Do not allow the to open any external resources by setting the property to null. The created object expands entity references and performs XML normalization of new line characters. Creates a new instance using the specified and objects. An object to read XML data. The from which to read the XML data. Because a returns a stream of Unicode characters, the encoding specified in the XML declaration is not used by the to decode the data stream The object used to configure the new . This value can be null. Method 2.0.0.0 4.0.0.0 System.Xml.XmlReader By default an with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on. This means that the can access any locations that does not require authentication. If the external resource is located on a network resource that requires authentication, use the property to specify an with the necessary credentials. You can restrict the resources that the can access by setting the property to an object The created object expands entity references and performs XML normalization of new line characters. Creates a new instance with the specified URI and . An object to read XML data. The URI for the file containing the XML data. The object on the object is used to convert the path to a canonical data representation. If is null, a new object is used. The object used to configure the new instance. This value can be null. Method 2.0.0.0 4.0.0.0 System.Xml.XmlReader This method allows you add additional features to an underlying object. The underlying object can be another object created by the method, or an object created using one of the concrete implementations. A default with no credentials is used to access any external resources such as a schema. If the external resource is located on a network resource that requires authentication, specify an with the necessary credentials using the property. You can use one of the following methods to control which resources the can access: Restrict the resources that the can access by setting the property to an object. -or- Do not allow the to open any external resources by setting the property to null. The created object expands entity references and performs XML normalization of new line characters. Creates a new instance with the specified and objects. An object that is wrapped around the specified object. The object that you wish to use as the underlying reader. The object used to configure the new instance. Method 2.0.0.0 4.0.0.0 System.Xml.XmlReader By default an with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on. If the external resource is located on a network resource that requires authentication, use the property to specify an with the necessary credentials. You can use one of the following methods to control which resources the can access: Restrict the resources that the can access by setting the property to an object. -or- Do not allow the to open any external resources by setting the property to null. The created object expands entity references and performs XML normalization of new line characters. Creates a new instance using the specified stream, base URI, and object. An object to read XML data. The stream containing the XML data. The object used to configure the new instance. This value can be null. The base URI for the entity or document being read. This value can be null. Method 2.0.0.0 4.0.0.0 System.Xml.XmlReader By default an with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on. If the external resource is located on a network resource that requires authentication, use the property to specify an with the necessary credentials. You can use one of the following methods to control which resources the can access: Restrict the resources that the can access by setting the property to an object. -or- Do not allow the to open any external resources by setting the property to null. The created object expands entity references and performs XML normalization of new line characters. Creates a new instance using the specified stream, , and objects. An object to read XML data. The stream containing the XML data. The object used to configure the new instance. This value can be null. The object that provides the context information required to parse the XML fragment. The context information can include the to use, encoding, namespace scope, the current xml:lang and xml:space scope, base URI, and document type definition. Method 2.0.0.0 4.0.0.0 System.Xml.XmlReader By default an with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on. If the external resource is located on a network resource that requires authentication, use the property to specify an with the necessary credentials. You can use one of the following methods to control which resources the can access: Restrict the resources that the can access by setting the property to an object. -or- Do not allow the to open any external resources by setting the property to null. The created object expands entity references and performs XML normalization of new line characters. Creates a new instance using the specified , , and base URI. An object to read XML data. The from which to read the XML data. Because a returns a stream of Unicode characters, the encoding specified in the XML declaration is not used by the to decode the data stream. The object used to configure the new instance. This value can be null. The base URI for the entity or document being read. This value can be null. Method 2.0.0.0 4.0.0.0 System.Xml.XmlReader By default an with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on. If the external resource is located on a network resource that requires authentication, use the property to specify an with the necessary credentials. You can use one of the following methods to control which resources the can access: Restrict the resources that the can access by setting the property to an object. -or- Do not allow the to open any external resources by setting the property to null. The created object expands entity references and performs XML normalization of new line characters. Creates a new instance using the specified , , and objects. An object to read XML data. The from which to read the XML data. Because a returns a stream of Unicode characters, the encoding specified in the XML declaration is not used by the to decode the data stream. The object used to configure the new instance. This value can be null. The object that provides the context information required to parse the XML fragment. The context information can include the to use, encoding, namespace scope, the current xml:lang and xml:space scope, base URI, and document type definition. Method 2.0.0.0 4.0.0.0 System.Xml.XmlReader By default an with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on. This means that the can access any locations that does not require authentication. If the external resource is located on a network resource that requires authentication, use the property to specify an with the necessary credentials. You can restrict the resources that the can access by setting the property to an object. The created object expands entity references and performs XML normalization of new line characters. Creates a new instance using the specified URI, , and objects. An object to read XML data. The URI for the file containing the XML data. The object on the object is used to convert the path to a canonical data representation. If is null, a new object is used. The object used to configure the new instance. This value can be null. The object that provides the context information required to parse the XML fragment. The context information can include the to use, encoding, namespace scope, the current xml:lang and xml:space scope, base URI, and document type definition. Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.Int32 A containing the depth of the current node in the XML document. As described above. This property is read-only. This property must be overridden in order to provide the functionality described above, as there is no default implementation. When overridden in a derived class, gets the depth of the current node in the XML document. 0 Method 4.0.0.0 System.Void To be added. Releases all resources used by the current instance of the class. Method 2.0.0.0 4.0.0.0 System.Void To be added. Releases the unmanaged resources used by the and optionally releases the managed resources. true to release both managed and unmanaged resources; false to release only unmanaged resources. Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.Boolean A where indicates the reader is positioned at the end of the stream; otherwise, . As described above. This property is read-only. This property must be overridden in order to provide the functionality described above, as there is no default implementation. When overridden in a derived class, gets a value indicating whether the reader is positioned at the end of the stream. 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.String This method does not move the reader. This method must be overridden in order to provide the functionality described above, as there is no default implementation. is less than 0, or greater than or equal to the of the containing element. For an example demonstrating this method, see (, ). When overridden in a derived class, gets the value of the attribute with the specified index. The value of the specified attribute. This method does not move the reader. The index of the attribute. The index is zero-based. (The first attribute has index 0.) 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.String For an example demonstrating this method, see (, ). This method does not move the reader. If the reader is positioned on a DocumentType node, this method can be used to get the PUBLIC and SYSTEM literals, for example, reader.GetAttribute("PUBLIC") When overridden in a derived class, gets the value of the attribute with the specified . The value of the specified attribute. If the attribute is not found or the value is String.Empty, null is returned. The qualified name of the attribute. 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.String For an example demonstrating this method, see (, ). The following XML contains an attribute in a specific namespace: <test xmlns:dt="urn:datatypes" dt:type="int"/> You can lookup the dt:type attribute using one argument (prefix and local name) or two arguments (local name and namespace URI): String dt = reader.GetAttribute("dt:type"); String dt2 = reader.GetAttribute("type","urn:datatypes"); To lookup the xmlns:dt attribute, use one of the following arguments: String dt3 = reader.GetAttribute("xmlns:dt"); String dt4 = reader.GetAttribute("dt",http://www.w3.org/2000/xmlns/); You can also get this information using the property. When overridden in a derived class, gets the value of the attribute with the specified and . The value of the specified attribute. If the attribute is not found or the value is String.Empty, null is returned. This method does not move the reader. The local name of the attribute. The namespace URI of the attribute. 0 Method 4.0.0.0 System.Threading.Tasks.Task<System.String> To use this method, you must set the flag to true. Asynchronously gets the value of the current node. The value of the current node. Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.Boolean A where indicates the current node has attributes; otherwise, . As described above. This property is read-only. This property returns if the property of the current node is greater than zero. Override this property to customize the behavior of this property in types derived from the class. Use this property to determine whether the current node has any attributes. Gets a value indicating whether the current node has any attributes. 0 Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.Boolean A where indicates the node on which the reader is currently positioned can have an associated text value; otherwise, . The following table lists node types that have a value to return. Node Type Value Attribute The value of the attribute. CDATA The content of the CDATA section. Comment The content of the comment. DocumentType The internal subset. ProcessingInstruction The entire content, excluding the target. SignificantWhitespace The white space between markup in a mixed content model. Text The content of the text node. Whitespace The white space between markup. XmlDeclaration The content of the declaration. When overridden in a derived class, gets a value indicating whether the current node can have a . 0 Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.Boolean A where indicates the current node is an attribute whose value was generated from the default value defined in the DTD or schema; indicates the attribute value was explicitly set. IsDefault always returns false for implementations of XmlReader that do not support schema or DTD information. This property applies only to an attribute node. 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. 0 Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.Boolean A where indicates the current node is an element ( equals ) that ends with "/>", otherwise,. This property enables you to determine the difference between the following: <item num="123"/> (IsEmptyElement is true). <item num="123"></item> (IsEmptyElement is false, although element content is empty). A corresponding EndElement node is not generated for empty elements. If default content has been added to an element due to schema validation, IsEmptyElement still returns true. It has no bearing on whether or not the element has a default value. In other words, IsEmptyElement simply reports whether or not the element in the source document had an end element tag. When overridden in a derived class, gets a value indicating whether the current node is an empty element (for example, <MyElement/>). 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.Boolean This method uses the W3C XML 1.0 Recommendation to determine whether the name is valid. Returns a value indicating whether the string argument is a valid XML name. true if the name is valid; otherwise, false. The name to validate. 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.Boolean This method uses the W3C XML 1.0 Recommendation to determine whether the name token is valid. Returns a value indicating whether or not the string argument is a valid XML name token. true if it is a valid name token; otherwise false. The name token to validate. 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.Boolean An error occurred while parsing the XML. This method skips white space, comments, and processing instructions until the reader is positioned on a content node. The method then tests if the current node is an element. Calls and tests if the current content node is a start tag or empty element tag. true if finds a start tag or empty element tag; false if a node type other than XmlNodeType.Element was found. 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.Boolean An error occurred while parsing the XML. This method skips white space, comments, and processing instructions until the reader is positioned on a content node. The method then tests if the current node is an element. Calls and tests if the current content node is a start tag or empty element tag and if the property of the element found matches the given argument. true if the resulting node is an element and the Name property matches the specified string. false if a node type other than XmlNodeType.Element was found or if the element Name property does not match the specified string. The string matched against the Name property of the element found. 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.Boolean An error occurred while parsing the XML. This method skips white space, comments, and processing instructions until the reader is positioned on a content node. The method then tests if the current node is an element. Calls and tests if the current content node is a start tag or empty element tag and if the and properties of the element found match the given strings. true if the resulting node is an element. false if a node type other than XmlNodeType.Element was found or if the LocalName and NamespaceURI properties of the element do not match the specified strings. The string to match against the LocalName property of the element found. The string to match against the NamespaceURI property of the element found. 0 Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.String A specifying the zero-based index of the attribute relative to the containing element. Retrieves the value of the attribute with the specified index relative to the containing element. A containing the value of the attribute. This property does not move the reader. This property must be overridden in order to provide the functionality described above, as there is no default implementation. is less than 0 or greater than or equal to the of the containing element. 0 Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.String A specifying the qualified name of the attribute. Retrieves the value of the attribute with the specified qualified name. A containing the value of the specified attribute, or if the attribute is not found. This property does not move the reader. If the reader is positioned on a node, this method can be used to get the PUBLIC and SYSTEM literals. This property must be overridden in order to provide the functionality described above, as there is no default implementation. 0 Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.String To be added. To be added. Retrieves the value of the attribute with the specified local name and namespace URI. A containing the value of the specified attribute, or if the attribute is not found. This property does not move the reader. This property must be overridden in order to provide the functionality described above, as there is no default implementation. 0 Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.String A containing the local name of the current node or, for node types that do not have a name (like , , and so on), . As described above. This property must be overridden in order to provide the functionality described above, as there is no default implementation. When overridden in a derived class, gets the local name of the current node. 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.String In the following XML string, if the reader is positioned on the href attribute, the prefix a is resolved by calling reader.LookupNamespace("a"). The returned string is urn:456. <root xmlns:a="urn:456"> <item> <ref href="a:b"/> </item> </root> When overridden in a derived class, resolves a namespace prefix in the current element's scope. The namespace URI to which the prefix maps or null if no matching prefix is found. The prefix whose namespace URI you want to resolve. To match the default namespace, pass an empty string. 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.Void After calling this method, the , , and properties reflect the properties of current attribute. This method must be overridden in order to provide the functionality described above, as there is no default implementation. is less than 0 or greater than or equal to the of the containing element. When overridden in a derived class, moves to the attribute with the specified index. The index of the attribute. 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.Boolean After calling MoveToAttribute, the , , and properties reflect the properties of that attribute. When overridden in a derived class, moves to the attribute with the specified . true if the attribute is found; otherwise, false. If false, the reader's position does not change. The qualified name of the attribute. 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.Boolean After calling MoveToAttribute, the , , and properties reflect the properties of that attribute. When overridden in a derived class, moves to the attribute with the specified and . true if the attribute is found; otherwise, false. If false, the reader's position does not change. The local name of the attribute. The namespace URI of the attribute. 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.Xml.XmlNodeType An error occurred while parsing the XML. If the current node is an attribute node, this method moves the reader back to the element that owns the attribute. For the asynchronous version of this method, see . 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. The of the current node found by the method or XmlNodeType.None if the reader has reached the end of the input stream. 0 Method 4.0.0.0 System.Threading.Tasks.Task<System.Xml.XmlNodeType> This is the asynchronous version of , with the same functionality. To use this method, you must set the flag to true. 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. The of the current node found by the method or XmlNodeType.None if the reader has reached the end of the input stream. Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.Boolean Use this method to return to an element after navigating through its attributes. This method moves the reader to one of the following node types: Element, DocumentType, or XmlDeclaration. When overridden in a derived class, moves to the element that contains the current attribute node. true if the reader is positioned on an attribute (the reader moves to the element that owns the attribute); false if the reader is not positioned on an attribute (the position of the reader does not change). 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.Boolean If is non-zero, the position of the reader moves to the first attribute; otherwise, the position of the reader does not change. This method must be overridden in order to provide the functionality described above, as there is no default implementation. When overridden in a derived class, moves to the first attribute. true if an attribute exists (the reader moves to the first attribute); otherwise, false (the position of the reader does not change). 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.Boolean If the current node is an element node, this method is equivalent to . If MoveToNextAttribute returns true, the reader moves to the next attribute; otherwise, the position of the reader does not change. When overridden in a derived class, moves to the next attribute. true if there is a next attribute; false if there are no more attributes. 0 Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.String A containing the qualified name of the current node or, for node types that do not have a name (like , , and so on), . The qualified name is equivalent to the prefixed with and the ':' character. For example, is "bk:book" for the element <bk:book>. The name returned is dependent on the of the node. The following node types return the listed values. All other node types return an empty string. Node Type Name The name of the attribute. The document type name. The tag name. The name of the entity referenced. The target of the processing instruction. The literal string "xml". This property is read-only. This property must be overridden in order to provide the functionality described above, as there is no default implementation. When overridden in a derived class, gets the qualified name of the current node. 0 Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.String A containing the namespace URI of the current node or, if no namespace URI is associated with the current node, . This property is relevant to Element and Attribute nodes only. 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. 0 Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.Xml.XmlNameTable The used by the current instance. All node and attribute names returned from are atomized using the NameTable. When the same name is returned multiple times (for example, Customer), then the same String object will be returned for that name. This makes it possible for you to write efficient code that does object comparisons on these strings instead of expensive string comparisons. When overridden in a derived class, gets the associated with this implementation. 0 Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.Xml.XmlNodeType One of the members of the enumeration representing the type of the current node. This property does not return the following members: , , , , and . This property is read-only. This property must be overridden in order to provide the functionality described above, as there is no default implementation. When overridden in a derived class, gets the type of the current node. 0 Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.String A containing the namespace prefix associated with the current node. A namespace prefix is used as a reference for a namespace URI and is defined in an element declaration. For example, <someElement xmlns:bk="someURL">, defines a prefix name "bk". As described above. This property is read-only. This property must be overridden in order to provide the functionality described above, as there is no default implementation. When overridden in a derived class, gets the namespace prefix associated with the current node. 0 Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.Char A specifying the quotation mark character (" or ') used to enclose the value of an attribute. This property applies only to an attribute node. When overridden in a derived class, gets the quotation mark character used to enclose the value of an attribute node. 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.Boolean An error occurred while parsing the XML. When an XmlReader is first created and initialized, there is no information available. You must call Read to read the first node. This method requires at least four bytes from the data stream in order to begin parsing. If fewer than four bytes are returned and there is no more data in the stream, the method will fail. If there is more data in the stream, the method will block parsing until receipt of the fourth byte. For the asynchronous version of this method, see . When overridden in a derived class, reads the next node from the stream. true if the next node was read successfully; false if there are no more nodes to read. 0 Method 4.0.0.0 System.Threading.Tasks.Task<System.Boolean> This is the asynchronous version of , with the same functionality. To use this method, you must set the flag to true. Asynchronously reads the next node from the stream. true if the next node was read successfully; false if there are no more nodes to read. Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.Boolean Use this method after calling to read through the text or entity reference nodes that make up the attribute value. The of the attribute value nodes is one plus the depth of the attribute node; it increments and decrements by one when you step into and out of general entity references. When overridden in a derived class, parses the attribute value into one or more Text, EntityReference, or EndEntity nodes. true if there are nodes to return. false if the reader is not positioned on an attribute node when the initial call is made or if all the attribute values have been read. An empty attribute, such as, misc="", returns true with a single node with a value of String.Empty. 0 Method 2.0.0.0 4.0.0.0 System.Object This method reads the text content at the current reader position and converts it to the requested return type. Text, white space, significant white space and CDATA sections are concatenated. Comments and processing instructions are skipped and entity references are automatically resolved. This method is used to read, convert if necessary, and return atomic value items from the current node content. If the input type is a valid mappings for the type of the current node then an instance of the target type containing the value of the current node is returned. The Mapping XML Data Types to CLR Types topic has a list of the default mappings. For example, if you had the following XML text: <elem>123 <!-- comment --> <?pi my_text?> 456 <?pi another_pi?></elem> If the data is typed and a string array is supplied to the method call, then the integer values are converted from strings according to the list of valid CLR type mappings. If the data is untyped and a string array is supplied to the method call, then the content is parsed into separate strings. An array containing two strings is returned with the values "123" and "456". The spaces are not preserved from the content. In general when reading untyped data the content is parsed according to the supplied type. For example, if an integer array is supplied to the method call then the string is parsed into an array of integers {123,456}. In the following example the XML text is not separated by spaces <elem>123<!-- comment --><?pi my_text?>456789<?pi another_pi?></elem> If the content is untyped and a string array is supplied to the method call then an array containing one concatenated string is returned with the value "123456789". The following table describes how this method treats each node type. XmlNodeType Return value Reader behavior Text CDATA Whitespace SignificantWhitespace EntityReference EndEntity Concatenated content of text, CDATA, white space and significant white space nodes converted to the requested type. Moves to the next start element or end element tag. Entity references are automatically expanded. Attribute Same as calling XmlConvert.ToXxx on the attribute value. The reader remains in the current position. Comment ProcessingInstruction Ignores the processing instruction (PI) or comment and reads the concatenated text content that follows the PI or comment. Moves to the next start element or end element tag. Entity references are automatically expanded. EndElement An empty string. The reader remains in the current position. Element XmlDeclaration None Document DocumentType Notation Entity DocumentFragment An is thrown. Undefined, although typically the reader remains in the current position. For more information, see Reading Typed Data and the W3C XML Schema Part 2: Datatypes recommendation. For the asynchronous version of this method, see . Reads the content as an object of the type specified. The concatenated text content or attribute value converted to the requested type. The type of the value to be returned. An object that is used to resolve any namespace prefixes related to type conversion. For example, this can be used when converting an object to an xs:string. Method 4.0.0.0 System.Threading.Tasks.Task<System.Object> This is the asynchronous version of , with the same functionality. To use this method, you must set the flag to true. Asynchronously reads the content as an object of the type specified. The concatenated text content or attribute value converted to the requested type. The type of the value to be returned. An object that is used to resolve any namespace prefixes related to type conversion. Method 2.0.0.0 4.0.0.0 System.Int32 This method streams the content, decodes the Base64 content, and returns the decoded binary bytes (for example, an inline Base64 encoded GIF image) into the buffer. This method can be called successively to read large streams of embedded text. For more information, see RFC 1521, "MIME (Multipurpose Internet Mail Extensions) Part One: Mechanisms for Specifying and Describing the Format of Internet Message Bodies". You can obtain RFCs from the Request for Comments Web site. You should not access any of the reader properties between calls to the method until the method returns the value 0. This method has the following behavior: returns the value 0 when it has reached the end of the byte stream it was operating on. The reader is positioned on the first non-content node. If you ask for fewer, or the exact number of, bytes than are left in the stream the reader remains in its current position. is not supported on the following XML node types: Element, XmlDeclaration, None, Document, DocumentType, Notation, Entity, DocumentFragment. For the asynchronous version of this method, see . Reads the content and returns the Base64 decoded binary bytes. The number of bytes written to the buffer. The buffer into which to copy the resulting text. This value cannot be null. The offset into the buffer where to start copying the result. The maximum number of bytes to copy into the buffer. The actual number of bytes copied is returned from this method. Method 4.0.0.0 System.Threading.Tasks.Task<System.Int32> This is the asynchronous version of , with the same functionality. To use this method, you must set the flag to true. Asynchronously reads the content and returns the Base64 decoded binary bytes. The number of bytes written to the buffer. The buffer into which to copy the resulting text. This value cannot be null. The offset into the buffer where to start copying the result. The maximum number of bytes to copy into the buffer. The actual number of bytes copied is returned from this method. Method 2.0.0.0 4.0.0.0 System.Int32 This method streams the content, decodes the BinHex content, and returns the decoded binary bytes (for example, an inline BinHex encoded GIF image) into the buffer. This method can be called successively to read large streams of embedded text. You should not access any of the reader properties between calls to the method until the method returns the value 0. This method has the following behavior: returns the value 0 when it has reached the end of the byte stream it was operating on. The reader is positioned on the first non-content node. If you ask for fewer, or the exact number, of bytes than are left in the stream the reader remains in its current position. is not supported on the following XML node types: Element, XmlDeclaration, None, Document, DocumentType, Notation, Entity, DocumentFragment. For the asynchronous version of this method, see . Reads the content and returns the BinHex decoded binary bytes. The number of bytes written to the buffer. The buffer into which to copy the resulting text. This value cannot be null. The offset into the buffer where to start copying the result. The maximum number of bytes to copy into the buffer. The actual number of bytes copied is returned from this method. Method 4.0.0.0 System.Threading.Tasks.Task<System.Int32> This is the asynchronous version of , with the same functionality. To use this method, you must set the flag to true. Asynchronously reads the content and returns the BinHex decoded binary bytes. The number of bytes written to the buffer. The buffer into which to copy the resulting text. This value cannot be null. The offset into the buffer where to start copying the result. The maximum number of bytes to copy into the buffer. The actual number of bytes copied is returned from this method. Method 2.0.0.0 4.0.0.0 System.Boolean This method concatenates text, white space, significant white space, and CDATA sections, and skips any comments or processing instructions. Entity references are automatically resolved. If the content is typed xsd:boolean, the reader returns an unboxed object. If the content is not typed xsd:boolean, the reader attempts to convert it to a object according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation. The following table describes how this method treats each node type. XmlNodeType Return value Reader behavior Text CDATA Whitespace SignificantWhitespace EntityReference EndEntity Concatenated content of text, CDATA, white space and significant white space nodes converted to the requested type. Moves to the next start element or end element tag. Entity references are automatically expanded. Attribute Same as calling XmlConvert.ToXxx on the attribute value. The reader remains in the current position. Comment ProcessingInstruction Ignores the processing instruction (PI) or comment and reads the concatenated text content that follows the PI or comment. Moves to the next start element or end element tag. Entity references are automatically expanded. EndElement An empty string. The reader remains in the current position. Element XmlDeclaration None Document DocumentType Notation Entity DocumentFragment An is thrown. Undefined, although typically the reader remains in the current position. For more information, see Reading Typed Data and the W3C XML Schema Part 2: Datatypes recommendation. Reads the text content at the current position as a Boolean. The text content as a object. Method 2.0.0.0 4.0.0.0 System.DateTime This method concatenates text, white space, significant white space, and CDATA sections, and skips any comments or processing instructions. Entity references are automatically resolved. If the content is typed xsd:dateTime, the reader returns an unboxed object. If the content is not typed xsd:dateTime, the reader attempts to convert it to a object according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation. You cannot rely on the value when the content is typed as xsd:gMonthDay. always sets the value to 1904 in this case. The following table describes how this method treats each node type. XmlNodeType Return value Reader behavior Text CDATA Whitespace SignificantWhitespace EntityReference EndEntity Concatenated content of text, CDATA, white space and significant white space nodes converted to the requested type. Moves to the next start element or end element tag. Entity references are automatically expanded. Attribute Same as calling XmlConvert.ToXxx on the attribute value. The reader remains in the current position. Comment ProcessingInstruction Ignores the processing instruction (PI) or comment and reads the concatenated text content that follows the PI or comment. Moves to the next start element or end element tag. Entity references are automatically expanded. EndElement An empty string. The reader remains in the current position. Element XmlDeclaration None Document DocumentType Notation Entity DocumentFragment An is thrown. Undefined, although typically the reader remains in the current position. For more information, see Reading Typed Data and the W3C XML Schema Part 2: Datatypes recommendation. Reads the text content at the current position as a object. The text content as a object. Method 4.0.0.0 System.DateTimeOffset To be added. Reads the text content at the current position as a object. The text content as a object. Method 2.0.0.0 4.0.0.0 System.Decimal This method concatenates text, white space, significant white space, and CDATA sections, and skips any comments or processing instructions. Entity references are automatically resolved. If the content is typed xsd:decimal, the reader returns an unboxed object. If the content is not typed xsd:decimal, the reader attempts to convert it to a object according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation. The following table describes how this method treats each node type. XmlNodeType Return value Reader behavior Text CDATA Whitespace SignificantWhitespace EntityReference EndEntity Concatenated content of text, CDATA, white space and significant white space nodes converted to the requested type. Moves to the next start element or end element tag. Entity references are automatically expanded. Attribute Same as calling XmlConvert.ToXxx on the attribute value. The reader remains in the current position. Comment ProcessingInstruction Ignores the processing instruction (PI) or comment and reads the concatenated text content that follows the PI or comment. Moves to the next start element or end element tag. Entity references are automatically expanded. EndElement An empty string. The reader remains in the current position. Element XmlDeclaration None Document DocumentType Notation Entity DocumentFragment An is thrown. Undefined, although typically the reader remains in the current position. For more information, see Reading Typed Data and the W3C XML Schema Part 2: Datatypes recommendation. Reads the text content at the current position as a object. The text content at the current position as a object. Method 2.0.0.0 4.0.0.0 System.Double This method concatenates text, white space, significant white space, and CDATA sections, and skips any comments or processing instructions. Entity references are automatically resolved. If the content is typed xsd:double, the reader returns a double-precision floating-point number. If the content is not typed xsd:double, the reader attempts to convert it to a double-precision floating-point number according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation. The following table describes how this method treats each node type. XmlNodeType Return value Reader behavior Text CDATA Whitespace SignificantWhitespace EntityReference EndEntity Concatenated content of text, CDATA, white space and significant white space nodes converted to the requested type. Moves to the next start element or end element tag. Entity references are automatically expanded. Attribute Same as calling XmlConvert.ToXxx on the attribute value. The reader remains in the current position. Comment ProcessingInstruction Ignores the processing instruction (PI) or comment and reads the concatenated text content that follows the PI or comment. Moves to the next start element or end element tag. Entity references are automatically expanded. EndElement An empty string. The reader remains in the current position. Element XmlDeclaration None Document DocumentType Notation Entity DocumentFragment An is thrown. Undefined, although typically the reader remains in the current position. For more information, see Reading Typed Data and the W3C XML Schema Part 2: Datatypes recommendation. Reads the text content at the current position as a double-precision floating-point number. The text content as a double-precision floating-point number. Method 2.0.0.0 4.0.0.0 System.Single This method concatenates text, white space, significant white space, and CDATA sections, and skips any comments or processing instructions. Entity references are automatically resolved. If the content is typed xsd:float, the reader returns an unboxed a single-precision floating point number. If the content is not typed xsd:float, the reader attempts to convert it to a single-precision floating point number according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation. The following table describes how this method treats each node type. XmlNodeType Return value Reader behavior Text CDATA Whitespace SignificantWhitespace EntityReference EndEntity Concatenated content of text, CDATA, white space and significant white space nodes converted to the requested type. Moves to the next start element or end element tag. Entity references are automatically expanded. Attribute Same as calling XmlConvert.ToXxx on the attribute value. The reader remains in the current position. Comment ProcessingInstruction Ignores the processing instruction (PI) or comment and reads the concatenated text content that follows the PI or comment. Moves to the next start element or end element tag. Entity references are automatically expanded. EndElement An empty string. The reader remains in the current position. Element XmlDeclaration None Document DocumentType Notation Entity DocumentFragment An is thrown. Undefined, although typically the reader remains in the current position. For more information, see Reading Typed Data and the W3C XML Schema Part 2: Datatypes recommendation. Reads the text content at the current position as a single-precision floating point number. The text content at the current position as a single-precision floating point number. Method 2.0.0.0 4.0.0.0 System.Int32 This method concatenates text, white space, significant white space, and CDATA sections, and skips any comments or processing instructions. Entity references are automatically resolved. If the content is typed xsd:integer, the reader returns an unboxed 32-bit signed integer. If the content is not typed xsd:integer, the reader attempts to convert it to a 32-bit signed integer according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation. The following table describes how this method treats each node type. XmlNodeType Return value Reader behavior Text CDATA Whitespace SignificantWhitespace EntityReference EndEntity Concatenated content of text, CDATA, white space and significant white space nodes converted to the requested type. Moves to the next start element or end element tag. Entity references are automatically expanded. Attribute Same as calling XmlConvert.ToXxx on the attribute value. The reader remains in the current position. Comment ProcessingInstruction Ignores the processing instruction (PI) or comment and reads the concatenated text content that follows the PI or comment. Moves to the next start element or end element tag. Entity references are automatically expanded. EndElement An empty string. The reader remains in the current position. Element XmlDeclaration None Document DocumentType Notation Entity DocumentFragment An is thrown. Undefined, although typically the reader remains in the current position. For more information, see Reading Typed Data and the W3C XML Schema Part 2: Datatypes recommendation. Reads the text content at the current position as a 32-bit signed integer. The text content as a 32-bit signed integer. Method 2.0.0.0 4.0.0.0 System.Int64 This method concatenates text, white space, significant white space, and CDATA sections, and skips any comments or processing instructions. Entity references are automatically resolved. If the content is typed xsd:long, the reader returns an unboxed 64-bit signed integer. If the content is not typed xsd:long, the reader attempts to convert it to a 64-bit signed integer according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation. The following table describes this method treats each node type. XmlNodeType Return value Reader behavior Text CDATA Whitespace SignificantWhitespace EntityReference EndEntity Concatenated content of text, CDATA, white space and significant white space nodes converted to the requested type. Moves to the next start element or end element tag. Entity references are automatically expanded. Attribute Same as XmlConvert.ToXxx on attribute value. The reader remains in the current position Comment ProcessingInstruction Ignores the processing instruction (PI) or comment and reads the concatenated text content that follows the PI or comment. Moves to the next start element or end element tag. Entity references are automatically expanded. EndElement An empty string. The reader remains in the current position. Element XmlDeclaration None Document DocumentType Notation Entity DocumentFragment An is thrown. Undefined, although typically the reader remains in the current position. For more information, see Reading Typed Data. Reads the text content at the current position as a 64-bit signed integer. The text content as a 64-bit signed integer. Method 2.0.0.0 4.0.0.0 System.Object This method concatenates text, white space, significant white space, and CDATA sections, and skips any comments or processing instructions. Entity references are automatically resolved. If the content is typed, the reader returns a boxed CLR of the most appropriate type, specified by the property. If the content is a list type, the reader returns an array of boxed objects of the appropriate type. If a validation error occurs while parsing the content and the reader is an object created by the method, the reader returns the content as a string. In other words when a validation error or warning occurs, the content is considered to be untyped. If the content is not typed, the reader returns the content as a string. The following table describes how this method treats each node type. XmlNodeType Return value Reader behavior Text CDATA Whitespace SignificantWhitespace EntityReference EndEntity Concatenated content of text, CDATA, white space and significant white space nodes converted to the requested type. Moves to the next start element or end element tag. Entity references are automatically expanded. Attribute Same as calling XmlConvert.ToXxx on the attribute value. The reader remains in the current position Comment ProcessingInstruction Ignores the processing instruction (PI) or comment and reads the concatenated text content that follows the PI or comment. Moves to the next start element or end element tag. Entity references are automatically expanded. EndElement The value of the element if the reader is a schema validating reader ( is set to ); otherwise an empty string. The reader remains in the current position. Element XmlDeclaration None Document DocumentType Notation Entity DocumentFragment An is thrown. Undefined, although typically the reader remains in the current position. For more information, see Reading Typed Data and the W3C XML Schema Part 2: Datatypes recommendation. For the asynchronous version of this method, see . Reads the text content at the current position as an . The text content as the most appropriate common language runtime (CLR) object. Method 4.0.0.0 System.Threading.Tasks.Task<System.Object> This is the asynchronous version of , with the same functionality. To use this method, you must set the flag to true. Asynchronously reads the text content at the current position as an . The text content as the most appropriate common language runtime (CLR) object. Method 2.0.0.0 4.0.0.0 System.String This method concatenates text, white space, significant white space, and CDATA sections, and skips any comments or processing instructions. Entity references are automatically resolved. This method can be used convert typed values to a string, or to read the text content while skipping comments and processing instructions. The following table describes how this method treats each node type. XmlNodeType Return value Reader behavior Text CDATA Whitespace SignificantWhitespace EntityReference EndEntity Concatenated content of text, CDATA, white space and significant white space nodes converted to the requested type. Moves to the next start element or end element tag. Entity references are automatically expanded. Attribute Same as calling XmlConvert.ToXxx on the attribute value. The reader remains in the current position. Comment ProcessingInstruction Ignores the processing instruction (PI) or comment and reads the concatenated text content that follows the PI or comment. Moves to the next start element or end element tag. Entity references are automatically expanded. EndElement An empty string. The reader remains in the current position. Element XmlDeclaration None Document DocumentType Notation Entity DocumentFragment An is thrown. Undefined, although typically the reader remains in the current position. For more information, see Reading Typed Data and the W3C XML Schema Part 2: Datatypes recommendation. For the asynchronous version of this method, see . Reads the text content at the current position as a object. The text content as a object. Method 4.0.0.0 System.Threading.Tasks.Task<System.String> This is the asynchronous version of , with the same functionality. To use this method, you must set the flag to true. Asynchronously reads the text content at the current position as a object. The text content as a object. Method 2.0.0.0 4.0.0.0 System.Object This method reads the start tag, the contents of the element, and moves the reader past the end element tag. It expands entities and ignores processing instructions and comments. The element can only contain simple content. That is, it cannot have child elements. For more information, see Reading Typed Data and the W3C XML Schema Part 2: Datatypes recommendation. For the asynchronous version of this method, see . Reads the element content as the requested type. The element content converted to the requested typed object. The type of the value to be returned. An object that is used to resolve any namespace prefixes related to type conversion. Method 2.0.0.0 4.0.0.0 System.Object This method reads the start tag, the contents of the element, and moves the reader past the end element tag. It expands entities and ignores processing instructions and comments. The element can only contain simple content. That is, it cannot have child elements. For more information, see Reading Typed Data and the W3C XML Schema Part 2: Datatypes recommendation. Checks that the specified local name and namespace URI matches that of the current element, then reads the element content as the requested type. The element content converted to the requested typed object. The type of the value to be returned. An object that is used to resolve any namespace prefixes related to type conversion. The local name of the element. The namespace URI of the element. Method 4.0.0.0 System.Threading.Tasks.Task<System.Object> This is the asynchronous version of , with the same functionality. To use this method, you must set the flag to true. Asynchronously reads the element content as the requested type. The element content converted to the requested typed object. The type of the value to be returned. An object that is used to resolve any namespace prefixes related to type conversion. Method 2.0.0.0 4.0.0.0 System.Int32 This method reads the element content, decodes it using Base64 encoding, and returns the decoded binary bytes (for example, an inline Base64-encoded GIF image) into the buffer. For more information, see RFC 1521, "MIME (Multipurpose Internet Mail Extensions) Part One: Mechanisms for Specifying and Describing the Format of Internet Message Bodies". You can obtain RFCs from the Request for Comments Web site. can only read simple-content elements. The element can contain text, white space, significant white space, CDATA sections, comments and processing instructions. It can also contain entity references, which are automatically expanded. The element cannot have child elements. This method is very similar to the method except that it can only be called on element node types. If the value is higher than the number of bytes in the document, or if it is equal to the number of bytes in the document, the reads all the remaining bytes in the document and returns the number of bytes read. The next method call returns a zero and moves the reader to the node following the EndElement. If you call before all of the element content is consumed, the reader may behave as if the first content was consumed and then the method was called. This means that the reader will read all the text until the end element is encountered. It will then read the end tag node, read the next node, and then position itself on the next subsequent node. For the asynchronous version of this method, see . Reads the element and decodes the Base64 content. The number of bytes written to the buffer. The buffer into which to copy the resulting text. This value cannot be null. The offset into the buffer where to start copying the result. The maximum number of bytes to copy into the buffer. The actual number of bytes copied is returned from this method. Method 4.0.0.0 System.Threading.Tasks.Task<System.Int32> This is the asynchronous version of , with the same functionality. To use this method, you must set the flag to true. Asynchronously reads the element and decodes the Base64 content. The number of bytes written to the buffer. The buffer into which to copy the resulting text. This value cannot be null. The offset into the buffer where to start copying the result. The maximum number of bytes to copy into the buffer. The actual number of bytes copied is returned from this method. Method 2.0.0.0 4.0.0.0 System.Int32 This method reads the element content, decodes it using BinHex encoding, and returns the decoded binary bytes (for example, an inline BinHex-encoded GIF image) into the buffer. This method can only read simple-content elements. The element can contain text, white space, significant white space, CDATA sections, comments and processing instructions. It can also contain entity references, which are automatically expanded. The element cannot have child elements. This method is very similar to the method except that it can only be called on element node types. If the value is higher than the number of bytes in the document, or if it is equal to the number of bytes in the document, the reads all the remaining bytes in the document and returns the number of bytes read. The next method call returns a zero and moves the reader to the node following the EndElement. If you call before all of the element content is consumed, the reader may behave as if the first content was consumed and then the method was called. This means that the reader will read all the text until the end element is encountered. It will then read the end tag node, read the next node, and then position itself on the next subsequent node. For the asynchronous version of this method, see . Reads the element and decodes the BinHex content. The number of bytes written to the buffer. The buffer into which to copy the resulting text. This value cannot be null. The offset into the buffer where to start copying the result. The maximum number of bytes to copy into the buffer. The actual number of bytes copied is returned from this method. Method 4.0.0.0 System.Threading.Tasks.Task<System.Int32> This is the asynchronous version of , with the same functionality. To use this method, you must set the flag to true. Asynchronously reads the element and decodes the BinHex content. The number of bytes written to the buffer. The buffer into which to copy the resulting text. This value cannot be null. The offset into the buffer where to start copying the result. The maximum number of bytes to copy into the buffer. The actual number of bytes copied is returned from this method. Method 2.0.0.0 4.0.0.0 System.Boolean This method reads the start tag, the contents of the element, and moves the reader past the end element tag. It expands entities and ignores processing instructions and comments. The element can only contain simple content. That is, it cannot have child elements. If the element content is typed xsd:boolean, the reader returns an unboxed object. If the content is not typed xsd:boolean, the reader attempts to convert it to a object according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation. For more information, see Reading Typed Data. Reads the current element and returns the contents as a object. The element content as a object. Method 2.0.0.0 4.0.0.0 System.Boolean This method reads the start tag, the contents of the element, and moves the reader past the end element tag. It expands entities and ignores processing instructions and comments. The element can only contain simple content. That is, it cannot have child elements. If the content is typed xsd:boolean, the reader returns an unboxed object. If the content is not typed xsd:boolean, the reader attempts to convert it to a object according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation. For more information, see Reading Typed Data. 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 object. The element content as a object. The local name of the element. The namespace URI of the element. Method 2.0.0.0 4.0.0.0 System.DateTime This method reads the start tag, the contents of the element, and moves the reader past the end element tag. It expands entities and ignores processing instructions and comments. The element can only contain simple content. That is, it cannot have child elements. If the content is typed xsd:dateTime, the reader returns an unboxed object. If the content is not typed xsd:dateTime, the reader attempts to convert it to a object according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation. You cannot rely on the value when the content is typed as xsd:gMonthDay. always sets the value to 1904 in this case. For more information, see Reading Typed Data. Reads the current element and returns the contents as a object. The element content as a object. Method 2.0.0.0 4.0.0.0 System.DateTime This method reads the start tag, the contents of the element, and moves the reader past the end element tag. It expands entities and ignores processing instructions and comments. The element can only contain simple content. That is, it cannot have child elements. If the content is typed xsd:dateTime, the reader returns an unboxed object. If the content is not typed xsd:dateTime, the reader attempts to convert it to a object according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation. You cannot rely on the value when the content is typed as xsd:gMonthDay. always sets the value to 1904 in this case. For more information, see Reading Typed Data. 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 object. The element contents as a object. The local name of the element. The namespace URI of the element. Method 2.0.0.0 4.0.0.0 System.Decimal This method reads the start tag, the contents of the element, and moves the reader past the end element tag. It expands entities and ignores processing instructions and comments. The element can only contain simple content. That is, it cannot have child elements. The reader attempts to convert the element content to an object according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation. For more information, see Reading Typed Data. Reads the current element and returns the contents as a object. The element content as a object. Method 2.0.0.0 4.0.0.0 System.Decimal This method reads the start tag, the contents of the element, and moves the reader past the end element tag. It expands entities and ignores processing instructions and comments. The element can only contain simple content. That is, it cannot have child elements. The reader attempts to convert the element content to an object according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation. For more information, see Reading Typed Data. 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 object. The element content as a object. The local name of the element. The namespace URI of the element. Method 2.0.0.0 4.0.0.0 System.Double This method reads the start tag, the contents of the element, and moves the reader past the end element tag. It expands entities and ignores processing instructions and comments. The element can only contain simple content. That is, it cannot have child elements. If the content is typed xsd:double, the reader returns a double-precision floating-point number. If the content is not typed xsd:double, the reader attempts to convert it to a double-precision floating-point number according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation. For more information, see Reading Typed Data. Reads the current element and returns the contents as a double-precision floating-point number. The element content as a double-precision floating-point number. Method 2.0.0.0 4.0.0.0 System.Double This method reads the start tag, the contents of the element, and moves the reader past the end element tag. It expands entities and ignores processing instructions and comments. The element can only contain simple content. That is, it cannot have child elements. If the content is typed xsd:double, the reader returns a double-precision floating-point number. If the content is not typed xsd:double, the reader attempts to convert it to a double-precision floating-point number according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation. For more information, see Reading Typed Data. 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. The element content as a double-precision floating-point number. The local name of the element. The namespace URI of the element. Method 2.0.0.0 4.0.0.0 System.Single This method reads the start tag, the contents of the element, and moves the reader past the end element tag. It expands entities and ignores processing instructions and comments. The element can only contain simple content. That is, it cannot have child elements. The reader attempts to convert the element content to a single-precision floating point number according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation. For more information, see Reading Typed Data. Reads the current element and returns the contents as single-precision floating-point number. The element content as a single-precision floating point number. Method 2.0.0.0 4.0.0.0 System.Single This method reads the start tag, the contents of the element, and moves the reader past the end element tag. It expands entities and ignores processing instructions and comments. The element can only contain simple content. That is, it cannot have child elements. The reader attempts to convert the element content to a single-precision floating point number according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation. For more information, see Reading Typed Data. 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. The element content as a single-precision floating point number. The local name of the element. The namespace URI of the element. Method 2.0.0.0 4.0.0.0 System.Int32 This method reads the start tag, the contents of the element, and moves the reader past the end element tag. It expands entities and ignores processing instructions and comments. The element can only contain simple content. That is, it cannot have child elements. If the content is typed xsd:integer, the reader returns an unboxed 32-bit signed integer. If the content is not typed xsd:integer, the reader attempts to convert it to a 32-bit signed integer according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation. For more information, see Reading Typed Data. Reads the current element and returns the contents as a 32-bit signed integer. The element content as a 32-bit signed integer. Method 2.0.0.0 4.0.0.0 System.Int32 This method reads the start tag, the contents of the element, and moves the reader past the end element tag. It expands entities and ignores processing instructions and comments. The element can only contain simple content. That is, it cannot have child elements. If the content is typed xsd:integer, the reader returns an unboxed 32-bit signed integer. If the content is not typed xsd:integer, the reader attempts to convert it to a 32-bit signed integer according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation. For more information, see Reading Typed Data. 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. The element content as a 32-bit signed integer. The local name of the element. The namespace URI of the element. Method 2.0.0.0 4.0.0.0 System.Int64 This method reads the start tag, the contents of the element, and moves the reader past the end element tag. It expands entities and ignores processing instructions and comments. The element can only contain simple content. That is, it cannot have child elements. If the content is typed xsd:long, the reader returns an unboxed 64-bit signed integer. If the content is not typed xsd:long, the reader attempts to convert it to a 64-bit signed integer according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation. For more information, see Reading Typed Data. Reads the current element and returns the contents as a 64-bit signed integer. The element content as a 64-bit signed integer. Method 2.0.0.0 4.0.0.0 System.Int64 This method reads the start tag, the contents of the element, and moves the reader past the end element tag. It expands entities and ignores processing instructions and comments. The element can only contain simple content. That is, it cannot have child elements. If the content is typed xsd:long, the reader returns an unboxed 64-bit signed integer. If the content is not typed xsd:long, the reader attempts to convert it to a 64-bit signed integer according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation. For more information, see Reading Typed Data. 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. The element content as a 64-bit signed integer. The local name of the element. The namespace URI of the element. Method 2.0.0.0 4.0.0.0 System.Object This method reads the start tag, the contents of the element, and moves the reader past the end element tag. It expands entities and ignores processing instructions and comments. The element can only contain simple content. That is, it cannot have child elements. For more information, see Reading Typed Data and the W3C XML Schema Part 2: Datatypes recommendation. For the asynchronous version of this method, see . Reads the current element and returns the contents as an . A boxed common language runtime (CLR) object of the most appropriate type. The property determines the appropriate CLR type. If the content is typed as a list type, this method returns an array of boxed objects of the appropriate type. Method 2.0.0.0 4.0.0.0 System.Object This method reads the start tag, the contents of the element, and moves the reader past the end element tag. It expands entities and ignores processing instructions and comments. The element can only contain simple content. That is, it cannot have child elements. For more information, see Reading Typed Data and the W3C XML Schema Part 2: Datatypes recommendation. 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 . A boxed common language runtime (CLR) object of the most appropriate type. The property determines the appropriate CLR type. If the content is typed as a list type, this method returns an array of boxed objects of the appropriate type. The local name of the element. The namespace URI of the element. Method 4.0.0.0 System.Threading.Tasks.Task<System.Object> This is the asynchronous version of , with the same functionality. To use this method, you must set the flag to true. Asynchronously reads the current element and returns the contents as an . A boxed common language runtime (CLR) object of the most appropriate type. The property determines the appropriate CLR type. If the content is typed as a list type, this method returns an array of boxed objects of the appropriate type. Method 2.0.0.0 4.0.0.0 System.String This method reads the start tag, the contents of the element, and moves the reader past the end element tag. It expands entities and ignores processing instructions and comments. The element can only contain simple content. That is, it cannot have child elements. For more information, see Reading Typed Data and the W3C XML Schema Part 2: Datatypes recommendation. For the asynchronous version of this method, see . Reads the current element and returns the contents as a object. The element content as a object. Method 2.0.0.0 4.0.0.0 System.String This method reads the start tag, the contents of the element, and moves the reader past the end element tag. It expands entities and ignores processing instructions and comments. The element can only contain simple content. That is, it cannot have child elements. For more information, see Reading Typed Data and the W3C XML Schema Part 2: Datatypes recommendation. 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 object. The element content as a object. The local name of the element. The namespace URI of the element. Method 4.0.0.0 System.Threading.Tasks.Task<System.String> This is the asynchronous version of , with the same functionality. To use this method, you must set the flag to true. Asynchronously reads the current element and returns the contents as a object. The element content as a object. Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.String The node is not an node, the element does not contain a simple text value, or an error occurred while parsing the XML. This is a helper method for reading simple text-only elements. It calls to find the next content node and then parses its value as a simple string. Using the XML, <name>Arlene Huff</name>, ReadElementString consumes the element and returns the string Arlene Huff. This method cannot handle any markup (child elements, comments, processing instructions, and so on) inside the name element, but it can concatenate multiple adjacent text and CDATA blocks. After calling this method the reader will be positioned on the node following the EndElement node or after the empty element tag. Reads a text-only element. The text contained in the element that was read. An empty string if the element is empty (<item></item> or <item/>). 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.String The node is not an node, the property of the node does not equal , the element does not contain a simple text value, or an error occurred while parsing the XML. This is a helper method for reading simple text-only elements. It calls to find the next content node and then parses its value as a simple string. Using the XML, <name>Arlene Huff</name>, ReadElementString consumes the element and returns the string Arlene Huff. This method cannot handle any markup (child elements, comments, processing instructions, and so on) inside the name element, but it can concatenate multiple adjacent text and CDATA blocks. After calling this method the reader will be positioned on the node following the EndElement node or after the empty element tag. Checks that the property of the element found matches the given string before reading a text-only element. The text contained in the element that was read. An empty string if the element is empty (<item></item> or <item/>). The name to check. 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.String The node is not an node, the property of the node does not equal , or the property of the node does not equal , the element does not contain a simple text value, or an error occurred while parsing the XML. This is a helper method for reading simple text-only elements. It calls to find the next content node and then parses its value as a simple string. Using the XML, <name>Arlene Huff</name>, ReadElementString consumes the element and returns the string Arlene Huff. This method cannot handle any markup (child elements, comments, processing instructions, and so on) inside the name element, but it can concatenate multiple adjacent text and CDATA blocks. After calling this method the reader will be positioned on the node following the EndElement node or after the empty element tag. Checks that the and properties of the element found matches the given strings before reading a text-only element. The text contained in the element that was read. An empty string if the element is empty (<item></item> or <item/>). The local name to check. The namespace URI to check. 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.Void As described above. This method calls the method, which determines whether the current node can contain content and, if not, moves the reader to the next content node or the end of the input stream. The node the reader ends up positioned on is checked to determine if it is an node. If so, the node is read and the reader is moved to the next node. Override this method to customize the behavior of this method in types derived from the class. Use this method to read an node and advance the reader to the next node. The node is not an node or an error occurred while parsing the XML. Checks that the current content node is an end tag and advances the reader to the next node. 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.String The XML was not well-formed, or an error occurred while parsing the XML. This method returns all the content of the current node including the markup. The current node (start tag) and corresponding end node (end tag) are not returned. For example, if you had the following: <node> this <child id="123"/> </node> ReadInnerXml returns this <child id="123"/> This method handles element and attribute nodes in the following manner: Node type Position before the call XML fragment Return value Position after the call Element On the item1 start tag. <item1>text1</item1><item2>text2</item2> text1 On the item2 start tag. Attribute On the attr1 attribute node. <item attr1="val1" attr2="val2">text</item> val1 Remains on the attr1 attribute node. If the reader is positioned on a leaf node, calling ReadInnerXml is equivalent to calling . The method returns String.Empty (except for attribute nodes, in which case the value of the attribute is returned). This method checks for well-formed XML. If ReadInnerXml is called from an , this method also validates the content returned. As implemented in the , and XmlValidatingReader classes the ReadOuterXml method is namespace aware. For the asynchronous version of this method, see . When overridden in a derived class, reads all the content, including markup, as a string. All the XML content, including markup, in the current node. If the current node has no children, an empty string is returned. If the current node is neither an element nor attribute, an empty string is returned. 0 Method 4.0.0.0 System.Threading.Tasks.Task<System.String> This is the asynchronous version of , with the same functionality. To use this method, you must set the flag to true. Asynchronously reads all the content, including markup, as a string. All the XML content, including markup, in the current node. If the current node has no children, an empty string is returned. Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.String The XML was not well-formed, or an error occurred while parsing the XML. This method is similar to except it also returns the start and end tags. This method handles element and attribute nodes in the following manner: Node type Position before the call XML fragment Return value Position After the Call Element On the item1 start tag. <item1>text1</item1><item2>text2</item2> <item1>text1</item1> On the item2 start tag. Attribute On the attr1 attribute node. <item attr1="val1" attr2="val2">text</item> attr1="val1" Remains on the attr1 attribute node. If the reader is positioned on a leaf node, calling ReadOuterXml is equivalent to calling . The method returns String.Empty (except for attribute nodes, in which case the attribute markup is returned). This method checks for well-formed XML. If ReadOuterXml is called from an , this method also validates the content returned As implemented in the , and XmlValidatingReader classes the ReadOuterXml method is namespace aware. Given the following XML text <A xmlns:S="urn:1"><S:B>hello</S:B></A>, if the reader were positioned on the S:B start tag, ReadOuterXml returns <S:B xmlns:S="urn:1">hello<S:B/>. For the asynchronous version of this method, see . When overridden in a derived class, reads the content, including markup, representing this node and all its children. If the reader is positioned on an element or an attribute node, this method returns all the XML content, including markup, of the current node and all its children; otherwise, it returns an empty string. 0 Method 4.0.0.0 System.Threading.Tasks.Task<System.String> This is the asynchronous version of , with the same functionality. To use this method, you must set the flag to true. Asynchronously reads the content, including markup, representing this node and all its children. If the reader is positioned on an element or an attribute node, this method returns all the XML content, including markup, of the current node and all its children; otherwise, it returns an empty string. Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.Void The node is not an node or an error occurred while parsing the XML. This method calls followed by to position you on the content of that element found in the input stream. Checks that the current node is an element and advances the reader to the next node. 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.Void The node is not an node, the property of the node does not equal , or an error occurred while parsing the XML. A call to this method corresponds to a call to followed by a call to . Checks that the current content node is an element with the given and advances the reader to the next node. The qualified name of the element. 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.Void The node is not an node, the property of the node does not equal , the property of the node does not equal , or an error occurred while parsing the XML. A call to this method corresponds to a call to followed by a call to . Checks that the current content node is an element with the given and and advances the reader to the next node. The local name of the element. The namespace URI of the element. 0 Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.Xml.ReadState One of the members of the enumeration. As described above. This property is read-only. This property must be overridden in order to provide the functionality described above, as there is no default implementation. When overridden in a derived class, gets the state of the reader. 0 Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.String An error occurred while parsing the XML. This method returns the content of element, text, white space, significant white space or CDATA nodes. If positioned on an element, ReadString concatenates all text, significant white space, white space, and CDATA section nodes together and returns the concatenated data as the element content. It stops when any markup is encountered, including comments and processing instructions. This could occur in a mixed content model, or when an element end tag is read. If positioned on an element text node, ReadString performs the same concatenation from the text node to the element end tag. If the reader is positioned on an attribute text node, ReadString has the same functionality as if the reader were positioned on the element start tag. It returns all the concatenated element text nodes. If positioned on an attribute, ReadString returns an empty string and moves the reader back to the element that owns the attribute. If ReadString is called on any other node type, it returns an empty string and the reader is positioned on the next node. When overridden in a derived class, reads the contents of an element or text node as a string. The contents of the element or an empty string. 0 Method 2.0.0.0 4.0.0.0 System.Xml.XmlReader can be called only on element nodes. When the entire sub-tree has been read, calls to the Read method returns false. When the new XmlReader has been closed, the original XmlReader will be positioned on the EndElement node of the sub-tree. Thus, if you called the method on the start tag of the book element, after the sub-tree has been read and the new XmlReader has been closed, the original XmlReader is positioned on the end tag of the book element. You should not perform any operations on the original XmlReader until the new XmlReader has been closed. This action is not supported and can result in unpredictable behavior. The method is not intended to create a copy of the XML data that you can work with independently. Rather, it can be used create a boundary around an XML element. This is useful if you need to pass data to another component for processing and you wish to limit how much of your data the component can access. When you pass an XmlReader returned by the method to another application, the application can access only that XML element, rather than the entire XML document. Returns a new XmlReader instance that can be used to read the current node, and all its descendants. A new XmlReader instance set to ReadState.Initial. A call to the method positions the new XmlReader on the node that was current before the call to ReadSubtree method. Method 2.0.0.0 4.0.0.0 System.Boolean To be added. Advances the to the next descendant element with the specified qualified name. true if a matching descendant element is found; otherwise false. If a matching child element is not found, the is positioned on the end tag ( is XmlNodeType.EndElement) of the element. If the is not positioned on an element when was called, this method returns false and the position of the is not changed. The qualified name of the element you wish to move to. Method 2.0.0.0 4.0.0.0 System.Boolean To be added. Advances the to the next descendant element with the specified local name and namespace URI. true if a matching descendant element is found; otherwise false. If a matching child element is not found, the is positioned on the end tag ( is XmlNodeType.EndElement) of the element. If the is not positioned on an element when was called, this method returns false and the position of the is not changed. The local name of the element you wish to move to. The namespace URI of the element you wish to move to. Method 2.0.0.0 4.0.0.0 System.Boolean This method is functionally equivalent executing the following::name XPath expression from the current node. It provides a quick way to find a named element in the XML document. It advances the reader to the next following element that matches the specified name and returns true if a matching element is found. Using the example below, the reader would read to the first instance of the specified element while reading forward. <!--"sample.xml"--> <?xml version="1.0" <items> <item xmls="urn:1"/> </items> </xml> XmlTextReader reader = new XmlTextReader("sample.xml"); reader.ReadToFollowing("item"); This method can be called on all node types. Reads until an element with the specified qualified name is found. true if a matching element is found; otherwise false and the is in an end of file state. The qualified name of the element. Method 2.0.0.0 4.0.0.0 System.Boolean This method is functionally equivalent executing the following::name XPath expression from the current node. It provides a quick way to find a named element in the XML document. It advances the reader to the next following element that matches the specified name and returns true if a matching element is found. <!--"sample.xml"--> <?xml version="1.0" <items> <item xmls="urn:1"/> </items> </xml> XmlTextReader reader = new XmlTextReader("sample.xml"); reader.ReadToFollowing("item", "urn:1"); This method can be called on all node types. Reads until an element with the specified local name and namespace URI is found. true if a matching element is found; otherwise false and the is in an end of file state. The local name of the element. The namespace URI of the element. Method 2.0.0.0 4.0.0.0 System.Boolean Do not call when the XmlReader is an initial state ( is ). You can call to advance the XmlReader and then call the method. Advances the XmlReader to the next sibling element with the specified qualified name. true if a matching sibling element is found; otherwise false. If a matching sibling element is not found, the XmlReader is positioned on the end tag ( is XmlNodeType.EndElement) of the parent element. The qualified name of the sibling element you wish to move to. Method 2.0.0.0 4.0.0.0 System.Boolean Do not call when the XmlReader is an initial state ( is ). You can call to advance the XmlReader and then call the method. Advances the XmlReader to the next sibling element with the specified local name and namespace URI. true if a matching sibling element is found; otherwise, false. If a matching sibling element is not found, the XmlReader is positioned on the end tag ( is XmlNodeType.EndElement) of the parent element. The local name of the sibling element you wish to move to. The namespace URI of the sibling element you wish to move to. Method 2.0.0.0 4.0.0.0 System.Int32 This method enables reading of very large streams of text embedded in an XML document in a streaming fashion, that is, a small number of characters at a time instead of allocating a single string for the whole value. This method can be called on any node that has a value ( is true), however actual streaming of the node value only occurs when called on a text, white space and significant white space nodes. Other node type values are cached, including attributes and CDATA nodes. This method returns only the content of the property and does not move the . This method reads the specified number of characters () of the node value into a character buffer () at a specified offset () and returns the number of characters written to the buffer. It returns the 0 when it has reached the end of the value. It cannot be restarted to read through the value again. In between calls to the properties do no change except for the property. When the property is accessed it may either return a partial value (with characters not yet returned by ) or a full value depending on the implementation. All the implementations in the namespace return a partial value for the property implementation. Any Read method can be called in between calls to . If this occurs, the moves to the next in the stream and any characters not yet returned are skipped. There may be a case when returns less than the requested number of characters. For example, if you had a 200-character long value with a surrogate pair at positions 127 and 128 and you called with a 128-character buffer, the method call would return 127 characters instead of the requested 128. The surrogate pair would then be returned in the next call. In this case, did not return the requested 128 characters because doing so would have resulted in an incomplete surrogate pair at the end of the buffer. For the asynchronous version of this method, see . Reads large streams of text embedded in an XML document. The number of characters read into the buffer. The value zero is returned when there is no more text content. The array of characters that serves as the buffer to which the text contents are written. This value cannot be null. The offset within the buffer where the can start to copy the results. The maximum number of characters to copy into the buffer. The actual number of characters copied is returned from this method. Method 4.0.0.0 System.Threading.Tasks.Task<System.Int32> This is the asynchronous version of , with the same functionality. To use this method, you must set the flag to true. Asynchronously reads large streams of text embedded in an XML document. The number of characters read into the buffer. The value zero is returned when there is no more text content. The array of characters that serves as the buffer to which the text contents are written. This value cannot be null. The offset within the buffer where the can start to copy the results. The maximum number of characters to copy into the buffer. The actual number of characters copied is returned from this method. Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.Void The reader is not positioned on a node. If the reader is positioned on an EntityReference node (XmlNodeType.EntityReference), if is called after calling this method, the entity replacement text is parsed. When the entity replacement text is finished, an EndEntity node is returned to close the entity reference scope. After calling this method, if the entity is part of an attribute value, you must call to step into the entity. When overridden in a derived class, resolves the entity reference for EntityReference nodes. 0 Property 2.0.0.0 4.0.0.0 System.Xml.Schema.IXmlSchemaInfo To be added. The interface exposes a subset of the Post Schema Validation Infoset (PSVI) associated with an XML node. Gets the schema information that has been assigned to the current node as a result of schema validation. Property 2.0.0.0 4.0.0.0 System.Xml.XmlReaderSettings To be added. The object can contain sensitive information such as user credentials. Applications must be careful when caching this object or passing it to another component. The class is used to specify the set of features to support on the created reader instance. The object returned by this property cannot be modified. Any attempt to change individual settings results in an exception being thrown. For more information, see Create XML Readers. Gets the object used to create this instance. Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.Void The XML was not well-formed, or an error occurred while parsing the XML. In the following XML input if the reader is positioned on the <a> node or any of its attributes, calling Skip positions the reader to the <b> node. If the reader is positioned on a leaf node already (such as the <x> node or the text node abc), calling Skip is the same as calling . <a name="bob" age="123"> <x/>abc<y/> </a> <b> ... </b> This method checks for well-formed XML. If the reader is an , this method also validates the skipped content. The XmlReader implementation determines whether or not the Skip method will expand external entities. The following table describes whether the external entities are expanded for the various types of XmlReader objects. TyType of XmlReader ExExpands external entities No. instance created by the method that is reading text data. No. instance created by the method that is reading binary data. Not applicable. A schema validating instance created by the method. Yes. Yes. instance returned by a object. Not applicable. No. instance wrapped around another instance. Depends on the implementation of the underlying . (The Skip method on the underlying is called). For the asynchronous version of this method, see . Skips the children of the current node. 0 Method 4.0.0.0 System.Threading.Tasks.Task This is the asynchronous version of , with the same functionality. To use this method, you must set the flag to true. Asynchronously skips the children of the current node. The current node. Method System.Void This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface. For a description of this member, see . 2.0.0.0 Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.String A containing the text value of the current node. For the asynchronous version of this property, see the method. When overridden in a derived class, gets the text value of the current node. 0 Property 2.0.0.0 4.0.0.0 System.Type To be added. See Mapping XML Data Types to CLR Types for a list of the default mappings. An element of type xs:int has a ValueType of System.Int32 by default. However, the ValueType could be one of the valid types that can be mapped to xs:int, such as System.Int16 or System.Double. If a node is un-typed, or if the node is an element that contains mixed content, the node value is mapped to the System.String type. Gets The Common Language Runtime (CLR) type for the current node. Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.String A containing the current xml:lang scope. This property represents the xml:lang scope within which the current node resides. For example, here is an XML fragment with xml:lang set to US English in the root element: <root xml:lang="en-us"> <name>Fred</name> </root> When the reader is positioned on the name element, you can use this property to find that it is in the scope of a US English xml:lang attribute. When overridden in a derived class, gets the current xml:lang scope. 0 Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.Xml.XmlSpace One of the members of the enumeration. If no xml:space scope exists, this property defaults to . As described above. This property is read-only. This property must be overridden in order to provide the functionality described above, as there is no default implementation. When overridden in a derived class, gets the current xml:space scope. 0 0