Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
8977 lines (7913 sloc) 629 KB
<Type Name="XmlReader" FullName="System.Xml.XmlReader">
<TypeSignature Language="C#" Value="public abstract class XmlReader : IDisposable" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract beforefieldinit XmlReader extends System.Object implements class System.IDisposable" />
<TypeSignature Language="DocId" Value="T:System.Xml.XmlReader" />
<TypeSignature Language="VB.NET" Value="Public MustInherit Class XmlReader&#xA;Implements IDisposable" />
<TypeSignature Language="C++ CLI" Value="public ref class XmlReader abstract : IDisposable" />
<TypeSignature Language="F#" Value="type XmlReader = class&#xA; interface IDisposable" />
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces>
<Interface>
<InterfaceName>System.IDisposable</InterfaceName>
</Interface>
</Interfaces>
<Attributes>
<Attribute FrameworkAlternate="netcore-2.0;netcore-2.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0">
<AttributeName>System.Diagnostics.DebuggerDisplay("{debuggerDisplayProxy}")</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Represents a reader that provides fast, noncached, forward-only access to XML data.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Xml.XmlReader> provides forward-only, read-only access to XML data in a document or stream. This class conforms to the W3C [Extensible Markup Language (XML) 1.0 (fourth edition)](https://www.w3.org/TR/2006/REC-xml-20060816/) and the [Namespaces in XML 1.0 (third edition)](https://www.w3.org/TR/REC-xml-names/) recommendations.
<xref:System.Xml.XmlReader> methods let you move through XML data and read the contents of a node. The properties of the class reflect the value of the current node, which is where the reader is positioned.The <xref:System.Xml.XmlReader.ReadState%2A> property value indicates the current state of the XML reader. For example, the property is set to <xref:System.Xml.ReadState.Initial?displayProperty=nameWithType> by the <xref:System.Xml.XmlReader.Read%2A?displayProperty=nameWithType> method and <xref:System.Xml.ReadState.Closed?displayProperty=nameWithType> by the <xref:System.Xml.XmlReader.Close%2A?displayProperty=nameWithType> method. <xref:System.Xml.XmlReader> also provides data conformance checks and validation against a DTD or schema.
<xref:System.Xml.XmlReader> uses a pull model to retrieve data. This model:
- Simplifies state management by a natural, top-down procedural refinement.
- Supports multiple input streams and layering.
- Enables the client to give the parser a buffer into which the string is directly written, and thus avoids the necessity of an extra string copy.
- Supports selective processing. The client can skip items and process those that are of interest to the application. You can also set properties in advance to manage how the XML stream is processed (for example, normalization).
In this section:
[Creating an XML reader](#xmlreader_create)
[Validating XML data](#xmlreader_validate)
[Data conformance](#xmlreader_data)
[Navigating through nodes](#xmlreader_nodes)
[Reading XML elements](#xmlreader_elements)
[Reading XML attributes](#xmlreader_attributes)
[Reading XML content](#xmlreader_content)
[Converting to CLR types](#xmlreader_clr)
[Asynchronous programming](#xmlreader_async)
[Security considerations](#xmlreader_security)
<a name="xmlreader_create"></a>
## Creating an XML reader
Use the <xref:System.Xml.XmlReader.Create%2A> method to create an <xref:System.Xml.XmlReader> instance.
Although the .NET Framework provides concrete implementations of the <xref:System.Xml.XmlReader> class, such as the <xref:System.Xml.XmlTextReader>, <xref:System.Xml.XmlNodeReader>, and the <xref:System.Xml.XmlValidatingReader> classes, we recommend that you use the specialized classes only in these scenarios:
- When you want to read an XML DOM subtree from an <xref:System.Xml.XmlNode> object, use the <xref:System.Xml.XmlNodeReader> class. (However, this class doesn't support DTD or schema validation.)
- If you must expand entities on request, you don't want your text content normalized, or you don't want default attributes returned, use the <xref:System.Xml.XmlTextReader> class.
To specify the set of features you want to enable on the XML reader, pass an <xref:System.Xml.XmlReaderSettings?displayProperty=nameWithType> object to the <xref:System.Xml.XmlReader.Create%2A> method. You can use a single <xref:System.Xml.XmlReaderSettings?displayProperty=nameWithType> object to create multiple readers with the same functionality, or modify the <xref:System.Xml.XmlReaderSettings?displayProperty=nameWithType> object to create a new reader with a different set of features. You can also easily add features to an existing reader.
If you don't use a <xref:System.Xml.XmlReaderSettings?displayProperty=nameWithType> object, default settings are used. See the <xref:System.Xml.XmlReader.Create%2A> reference page for details.
<xref:System.Xml.XmlReader> throws an <xref:System.Xml.XmlException> 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 <xref:System.Xml.XmlReader.ReadState%2A> property to check whether the reader is in error state.
<a name="xmlreader_validate"></a>
## Validating XML data
To define the structure of an XML document and its element relationships, data types, and content constraints, you use a document type definition (DTD) or XML Schema definition language (XSD) schema. An XML document is considered to be well formed if it meets all the syntactical requirements defined by the [W3C XML 1.0 Recommendation](https://www.w3.org/TR/2006/REC-xml-20060816/). It's considered valid if it's well formed and also conforms to the constraints defined by its DTD or schema. (See the [W3C XML Schema Part 1: Structures](https://www.w3.org/TR/xmlschema-1/) and the [W3C XML Schema Part 2: Datatypes](https://www.w3.org/TR/xmlschema-2/) recommendations.) Therefore, although all valid XML documents are well formed, not all well-formed XML documents are valid.
You can validate the data against a DTD, an inline XSD Schema, or an XSD Schema stored in an <xref:System.Xml.Schema.XmlSchemaSet> object (a cache); these scenarios are described on the <xref:System.Xml.XmlReader.Create%2A> reference page. <xref:System.Xml.XmlReader> doesn't support XML-Data Reduced (XDR) schema validation.
You use the following settings on the <xref:System.Xml.XmlReaderSettings> class to specify what type of validation, if any, the <xref:System.Xml.XmlReader> instance supports.
|Use this <xref:System.Xml.XmlReaderSettings> member|To specify|
|-----------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|
|<xref:System.Xml.XmlReaderSettings.DtdProcessing%2A> property|Whether to allow DTD processing. The default is to disallow DTD processing.|
|<xref:System.Xml.XmlReaderSettings.ValidationType%2A> property|Whether the reader should validate data, and what type of validation to perform (DTD or schema). The default is no data validation.|
|<xref:System.Xml.XmlReaderSettings.ValidationEventHandler> event|An event handler for receiving information about validation events. If an event handler is not provided, an <xref:System.Xml.XmlException> is thrown on the first validation error.|
|<xref:System.Xml.XmlReaderSettings.ValidationFlags%2A> property|Additional validation options through the <xref:System.Xml.Schema.XmlSchemaValidationFlags> enumeration members:<br /><br /> - `AllowXmlAttributes`-- Allow XML attributes (`xml:*`) in instance documents even when they're not defined in the schema. The attributes are validated based on their data type. See the <xref:System.Xml.Schema.XmlSchemaValidationFlags> reference page for the setting to use in specific scenarios. (Disabled by default.)<br />- `ProcessIdentityConstraints` --Process identity constraints (`xs:ID`, `xs:IDREF`, `xs:key`, `xs:keyref`, `xs:unique`) encountered during validation. (Enabled by default.)<br />- `ProcessSchemaLocation` --Process schemas specified by the `xsi:schemaLocation` or `xsi:noNamespaceSchemaLocation` attribute. (Enabled by default.)<br />- `ProcessInlineSchema`-- Process inline XML Schemas during validation. (Disabled by default.)<br />- `ReportValidationWarnings`--Report events if a validation warning occurs. A warning is typically issued when there is no DTD or XML Schema to validate a particular element or attribute against. The <xref:System.Xml.XmlReaderSettings.ValidationEventHandler> is used for notification. (Disabled by default.)|
|<xref:System.Xml.XmlReaderSettings.Schemas%2A>|The <xref:System.Xml.Schema.XmlSchemaSet> to use for validation.|
|<xref:System.Xml.XmlReaderSettings.XmlResolver%2A> property|The <xref:System.Xml.XmlResolver> for resolving and accessing external resources. This can include external entities such as DTD and schemas, and any `xs:include` or `xs:import` elements contained in the XML Schema. If you don't specify an <xref:System.Xml.XmlResolver>, the <xref:System.Xml.XmlReader> uses a default <xref:System.Xml.XmlUrlResolver> with no user credentials.|
<a name="xmlreader_data"></a>
## Data conformance
XML readers that are created by the <xref:System.Xml.XmlReader.Create%2A> method meet the following compliance requirements by default:
- New lines and attribute value are normalized according to the W3C [XML 1.0 Recommendation](https://www.w3.org/TR/2006/REC-xml-20060816/).
- All entities are automatically expanded.
- Default attributes declared in the document type definition are always added even when the reader doesn't validate.
- Declaration of XML prefix mapped to the correct XML namespace URI is allowed.
- The notation names in a single `NotationType` attribute declaration and `NmTokens` in a single `Enumeration` attribute declaration are distinct.
Use these <xref:System.Xml.XmlReaderSettings> properties to specify the type of conformance checks you want to enable:
|Use this <xref:System.Xml.XmlReaderSettings> property|To|Default|
|-------------------------------------------------------------------------------------------------------------------------------------------------------------|--------|-------------|
|<xref:System.Xml.XmlReaderSettings.CheckCharacters%2A> property|Enable or disable checks for the following:<br /><br /> - Characters are within the range of legal XML characters, as defined by the [2.2 Characters](https://www.w3.org/TR/2006/REC-xml-20060816/#charsets) section of the W3C XML 1.0 Recommendation.<br />- All XML names are valid, as defined by the [2.3 Common Syntactic Constructs](https://www.w3.org/TR/2006/REC-xml-20060816/#NT-Name) section of the W3C XML 1.0 Recommendation.<br /><br /> When this property is set to `true` (default), an <xref:System.Xml.XmlException> exception is thrown if the XML file contains illegal characters or invalid XML names (for example, an element name starts with a number).|Character and name checking is enabled.<br /><br /> Setting <xref:System.Xml.XmlReaderSettings.CheckCharacters%2A> to `false` turns off character checking for character entity references. If the reader is processing text data, it always checks that XML names are valid, regardless of this setting. **Note:** The XML 1.0 recommendation requires document-level conformance when a DTD is present. Therefore, if the reader is configured to support <xref:System.Xml.ConformanceLevel.Fragment?displayProperty=nameWithType>, but the XML data contains a document type definition (DTD), an <xref:System.Xml.XmlException> is thrown.|
|<xref:System.Xml.XmlReaderSettings.ConformanceLevel%2A> property|Choose the level of conformance to enforce:<br /><br /> - <xref:System.Xml.ConformanceLevel.Document>. Conforms to the rules for a [well-formed XML 1.0 document](https://www.w3.org/TR/2006/REC-xml-20060816/#sec-well-formed).<br />- <xref:System.Xml.ConformanceLevel.Fragment>. Conforms to the rules for a well-formed document fragment that can be consumed as an [external parsed entity](https://www.w3.org/TR/2006/REC-xml-20060816/#wf-entities).<br />- <xref:System.Xml.ConformanceLevel.Auto>. Conforms to the level decided by the reader.<br /><br /> If the data isn't in conformance, an <xref:System.Xml.XmlException> exception is thrown.|<xref:System.Xml.ConformanceLevel.Document>|
<a name="xmlreader_nodes"></a>
## Navigating through nodes
The current node is the XML node on which the XML reader is currently positioned. All <xref:System.Xml.XmlReader> methods perform operations in relation to this node, and all <xref:System.Xml.XmlReader> properties reflect the value of the current node.
The following methods make it easy to navigate through nodes and parse data.
|Use this <xref:System.Xml.XmlReaderSettings> method|To|
|-----------------------------------------------------------------------------------------------------------------------------------------------------------|--------|
|<xref:System.Xml.XmlReader.Read%2A>|Read the first node, and advance through the stream one node at a time. Such calls are typically performed inside a `while` loop.<br /><br /> Use the <xref:System.Xml.XmlReader.NodeType%2A> property to get the type (for example, attribute, comment, element, and so on) of the current node.|
|<xref:System.Xml.XmlReader.Skip%2A>|Skip the children of the current node and move to the next node.|
|<xref:System.Xml.XmlReader.MoveToContent%2A> and <xref:System.Xml.XmlReader.MoveToContentAsync%2A>|Skip non-content nodes and move to the next content node or to the end of the file.<br /><br /> Non-content nodes include <xref:System.Xml.XmlNodeType.ProcessingInstruction>, <xref:System.Xml.XmlNodeType.DocumentType>, <xref:System.Xml.XmlNodeType.Comment>, <xref:System.Xml.XmlNodeType.Whitespace>, and <xref:System.Xml.XmlNodeType.SignificantWhitespace>.<br /><br /> Content nodes include non-white space text, <xref:System.Xml.XmlNodeType.CDATA>, <xref:System.Xml.XmlNodeType.EntityReference> , and <xref:System.Xml.XmlNodeType.EndEntity>.|
|<xref:System.Xml.XmlReader.ReadSubtree%2A>|Read an element and all its children, and return a new <xref:System.Xml.XmlReader> instance set to <xref:System.Xml.ReadState.Initial?displayProperty=nameWithType>.<br /><br /> This method is useful for creating boundaries around XML elements; for example, if you want to pass data to another component for processing and you want to limit how much of your data the component can access.|
See the <xref:System.Xml.XmlReader.Read%2A?displayProperty=nameWithType> reference page for an example of navigating through a text stream one node at a time and displaying the type of each node.
The following sections describe how you can read specific types of data, such as elements, attributes, and typed data.
<a name="xmlreader_elements"></a>
## Reading XML elements
The following table lists the methods and properties that the <xref:System.Xml.XmlReader> class provides for processing elements. After the <xref:System.Xml.XmlReader> is positioned on an element, the node properties, such as <xref:System.Xml.XmlReader.Name%2A>, reflect the element values. In addition to the members described below, any of the general methods and properties of the <xref:System.Xml.XmlReader> class can also be used to process elements. For example, you can use the <xref:System.Xml.XmlReader.ReadInnerXml%2A> method to read the contents of an element.
> [!NOTE]
> See section 3.1 of the [W3C XML 1.0 Recommendation](https://www.w3.org/TR/2006/REC-xml-20060816/#sec-starttags) for definitions of start tags, end tags, and empty element tags.
|Use this <xref:System.Xml.XmlReader> member|To|
|---------------------------------------------------------------------------------------------------------------------------------------------------|--------|
|<xref:System.Xml.XmlReader.IsStartElement%2A> method|Check if the current node is a start tag or an empty element tag.|
|<xref:System.Xml.XmlReader.ReadStartElement%2A> method|Check that the current node is an element and advance the reader to the next node (calls <xref:System.Xml.XmlReader.IsStartElement%2A> followed by <xref:System.Xml.XmlReader.Read%2A>).|
|<xref:System.Xml.XmlReader.ReadEndElement%2A> method|Check that the current node is an end tag and advance the reader to the next node.|
|<xref:System.Xml.XmlReader.ReadElementString%2A> method|Read a text-only element.|
|<xref:System.Xml.XmlReader.ReadToDescendant%2A> method|Advance the XML reader to the next descendant (child) element that has the specified name.|
|<xref:System.Xml.XmlReader.ReadToNextSibling%2A> method|Advance the XML reader to the next sibling element that has the specified name.|
|<xref:System.Xml.XmlReader.IsEmptyElement%2A> property|Check if the current element has an end element tag. For example:<br /><br /> - `<item num="123"/>` (<xref:System.Xml.XmlReader.IsEmptyElement%2A> is `true`.)<br />- `<item num="123"> </item>` (<xref:System.Xml.XmlReader.IsEmptyElement%2A> is `false`, although the element's content is empty.)|
For an example of reading the text content of elements, see the <xref:System.Xml.XmlReader.ReadString%2A> method. The following example processes elements by using a `while` loop.
[!code-csharp[XmlReaderBasic#10](~/samples/snippets/csharp/VS_Snippets_Data/XmlReaderBasic/CS/XmlReader_Basic.cs#10)]
[!code-vb[XmlReaderBasic#10](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReaderBasic/VB/xmlreader_basic.vb#10)]
<a name="xmlreader_attributes"></a>
## Reading XML attributes
XML attributes are most commonly found on elements, but they're also allowed on XML declaration and document type nodes.
When positioned on an element node, the <xref:System.Xml.XmlReader.MoveToAttribute%2A> method lets you go through the attribute list of the element. Note that after <xref:System.Xml.XmlReader.MoveToAttribute%2A> has been called, node properties such as <xref:System.Xml.XmlReader.Name%2A>, <xref:System.Xml.XmlReader.NamespaceURI%2A>, and <xref:System.Xml.XmlReader.Prefix%2A> reflect the properties of that attribute, not the properties of the element the attribute belongs to.
The <xref:System.Xml.XmlReader> class provides these methods and properties to read and process attributes on elements.
|Use this <xref:System.Xml.XmlReader> member|To|
|---------------------------------------------------------------------------------------------------------------------------------------------------|--------|
|<xref:System.Xml.XmlReader.HasAttributes%2A> property|Check whether the current node has any attributes.|
|<xref:System.Xml.XmlReader.AttributeCount%2A> property|Get the number of attributes on the current element.|
|<xref:System.Xml.XmlReader.MoveToFirstAttribute%2A> method|Move to the first attribute in an element.|
|<xref:System.Xml.XmlReader.MoveToNextAttribute%2A> method|Move to the next attribute in an element.|
|<xref:System.Xml.XmlReader.MoveToAttribute%2A> method|Move to a specified attribute.|
|<xref:System.Xml.XmlReader.GetAttribute%2A> method or <xref:System.Xml.XmlReader.Item%2A> property|Get the value of a specified attribute.|
|<xref:System.Xml.XmlReader.IsDefault%2A> property|Check whether the current node is an attribute that was generated from the default value defined in the DTD or schema.|
|<xref:System.Xml.XmlReader.MoveToElement%2A> method|Move to the element that owns the current attribute. Use this method to return to an element after navigating through its attributes.|
|<xref:System.Xml.XmlReader.ReadAttributeValue%2A> method|Parse the attribute value into one or more `Text`, `EntityReference`, or `EndEntity` nodes.|
Any of the general <xref:System.Xml.XmlReader> methods and properties can also be used to process attributes. For example, after the <xref:System.Xml.XmlReader> is positioned on an attribute, the <xref:System.Xml.XmlReader.Name%2A> and <xref:System.Xml.XmlReader.Value%2A> properties reflect the values of the attribute. You can also use any of the content `Read` methods to get the value of the attribute.
This example uses the <xref:System.Xml.XmlReader.AttributeCount%2A> property to navigate through all the attributes on an element.
[!code-csharp[XmlReaderBasic#1](~/samples/snippets/csharp/VS_Snippets_Data/XmlReaderBasic/CS/XmlReader_Basic.cs#1)]
[!code-vb[XmlReaderBasic#1](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReaderBasic/VB/xmlreader_basic.vb#1)]
This example uses the <xref:System.Xml.XmlReader.MoveToNextAttribute%2A> method in a `while` loop to navigate through the attributes.
[!code-csharp[XmlReaderBasic#6](~/samples/snippets/csharp/VS_Snippets_Data/XmlReaderBasic/CS/XmlReader_Basic.cs#6)]
[!code-vb[XmlReaderBasic#6](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReaderBasic/VB/xmlreader_basic.vb#6)]
**Reading attributes on XML declaration nodes**
When the XML reader is positioned on an XML declaration node, the <xref:System.Xml.XmlReader.Value%2A> property returns the version, standalone, and encoding information as a single string. <xref:System.Xml.XmlReader> objects created by the <xref:System.Xml.XmlReader.Create%2A> method, the <xref:System.Xml.XmlTextReader> class, and the <xref:System.Xml.XmlValidatingReader> class expose the version, standalone, and encoding items as attributes.
**Reading attributes on document type nodes**
When the XML reader is positioned on a document type node, the <xref:System.Xml.XmlReader.GetAttribute%2A> method and <xref:System.Xml.XmlReader.Item%2A> property can be used to return the values for the SYSTEM and PUBLIC literals. For example, calling `reader.GetAttribute("PUBLIC")` returns the PUBLIC value.
**Reading attributes on processing instruction nodes**
When the <xref:System.Xml.XmlReader> is positioned on a processing instruction node, the <xref:System.Xml.XmlReader.Value%2A> property returns the entire text content. Items in the processing instruction node aren't treated as attributes. They can't be read with the <xref:System.Xml.XmlReader.GetAttribute%2A> or <xref:System.Xml.XmlReader.MoveToAttribute%2A> method.
<a name="xmlreader_content"></a>
## Reading XML content
The XMLReader class includes the following members that read content from an XML file and return the content as string values. (To return CLR types, see the [next section](#xmlreader_clr).)
|Use this <xref:System.Xml.XmlReader> member|To|
|---------------------------------------------------------------------------------------------------------------------------------------------------|--------|
|<xref:System.Xml.XmlReader.Value%2A> property|Get the text content of the current node. The value returned depends on the node type; see the <xref:System.Xml.XmlReader.Value%2A> reference page for details.|
|<xref:System.Xml.XmlReader.ReadString%2A> method|Get the content of an element or text node as a string. This method stops on processing instructions and comments.<br /><br /> For details on how this method handles specific node types, see the <xref:System.Xml.XmlReader.ReadString%2A> reference page.|
|<xref:System.Xml.XmlReader.ReadInnerXml%2A> and <xref:System.Xml.XmlReader.ReadInnerXmlAsync%2A> methods|Get all the content of the current node, including the markup, but excluding start and end tags. For example, for:<br /><br /> `<node>this<child id="123"/></node>`<br /><br /> <xref:System.Xml.XmlReader.ReadInnerXml%2A> returns:<br /><br /> `this<child id="123"/>`|
|<xref:System.Xml.XmlReader.ReadOuterXml%2A> and <xref:System.Xml.XmlReader.ReadOuterXmlAsync%2A> methods|Get all the content of the current node and its children, including markup and start/end tags. For example, for:<br /><br /> `<node>this<child id="123"/></node>`<br /><br /> <xref:System.Xml.XmlReader.ReadOuterXml%2A> returns:<br /><br /> `<node>this<child id="123"/></node>`|
<a name="xmlreader_clr"></a>
## Converting to CLR types
You can use the members of the <xref:System.Xml.XmlReader> class (listed in the following table) to read XML data and return values as common language runtime (CLR) types instead of strings. These members enable you to get values in the representation that is most appropriate for your coding task without having to manually parse or convert string values.
- The **ReadElementContentAs** methods can only be called on element node types. These methods cannot be used on elements that contain child elements or mixed content. When called, the <xref:System.Xml.XmlReader> object reads the start tag, reads the element content, and then moves past the end element tag. Processing instructions and comments are ignored and entities are expanded.
- The **ReadContentAs** methods read the text content at the current reader position, and if the XML data doesn't have any schema or data type information associated with it, convert the text content 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.
The <xref:System.Xml.XmlReader> class uses the rules defined by the [W3C XML Schema Part 2: Datatypes](https://www.w3.org/TR/xmlschema-2/) recommendation.
|Use this <xref:System.Xml.XmlReader> method|To return this CLR type|
|--------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
|<xref:System.Xml.XmlReader.ReadContentAsBoolean%2A> and <xref:System.Xml.XmlReader.ReadElementContentAsBoolean%2A>|<xref:System.Boolean>|
|<xref:System.Xml.XmlReader.ReadContentAsDateTime%2A> and <xref:System.Xml.XmlReader.ReadElementContentAsDateTime%2A>|<xref:System.DateTime>|
|<xref:System.Xml.XmlReader.ReadContentAsDouble%2A> and <xref:System.Xml.XmlReader.ReadElementContentAsDouble%2A>|<xref:System.Double>|
|<xref:System.Xml.XmlReader.ReadContentAsLong%2A> and <xref:System.Xml.XmlReader.ReadElementContentAsLong%2A>|<xref:System.Int64>|
|<xref:System.Xml.XmlReader.ReadContentAsInt%2A> and <xref:System.Xml.XmlReader.ReadElementContentAsInt%2A>|<xref:System.Int32>|
|<xref:System.Xml.XmlReader.ReadContentAsString%2A> and <xref:System.Xml.XmlReader.ReadElementContentAsString%2A>|<xref:System.String>|
|<xref:System.Xml.XmlReader.ReadContentAs%2A> and <xref:System.Xml.XmlReader.ReadElementContentAs%2A>|The type you specify with the `returnType` parameter|
|<xref:System.Xml.XmlReader.ReadContentAsObject%2A> and <xref:System.Xml.XmlReader.ReadElementContentAsObject%2A>|The most appropriate type, as specified by the <xref:System.Xml.XmlReader.ValueType%2A?displayProperty=nameWithType> property. See [Type Support in the System.Xml Classes](~/docs/standard/data/xml/type-support-in-the-system-xml-classes.md) for mapping information.|
If an element can't easily be converted to a CLR type because of its format, you can use a schema mapping to ensure a successful conversion. The following example uses an .xsd file to convert the `hire-date` element to the `xs:date` type, and then uses the <xref:System.Xml.XmlReader.ReadElementContentAsDateTime%2A> method to return the element as a <xref:System.DateTime> object.
**Input (hireDate.xml):**
[!code-xml[XmlReader.ReadElementContentAs#9](~/samples/snippets/xml/VS_Snippets_Data/XmlReader.ReadElementContentAs/XML/hireDate.xml#9)]
**Schema (hireDate.xsd):**
[!code-xml[XmlReader.ReadElementContentAs#10](~/samples/snippets/xml/VS_Snippets_Data/XmlReader.ReadElementContentAs/XML/hireDate.xsd#10)]
**Code:**
[!code-csharp[XmlReader.ReadElementContentAs#13](~/samples/snippets/csharp/VS_Snippets_Data/XmlReader.ReadElementContentAs/CS/readElementContentAs.cs#13)]
[!code-vb[XmlReader.ReadElementContentAs#13](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReader.ReadElementContentAs/VB/readElementContentAs.vb#13)]
**Output:**
```
Six Month Review Date: 7/8/2003 12:00:00 AM
```
<a name="xmlreader_async"></a>
## Asynchronous programming
Most of the <xref:System.Xml.XmlReader> methods have asynchronous counterparts that have "Async" at the end of their method names. For example, the asynchronous equivalent of <xref:System.Xml.XmlReader.ReadContentAsObject%2A> is <xref:System.Xml.XmlReader.ReadContentAsObjectAsync%2A>.
The following methods can be used with asynchronous method calls:
- <xref:System.Xml.XmlReader.GetAttribute%2A>
- <xref:System.Xml.XmlReader.MoveToAttribute%2A>
- <xref:System.Xml.XmlReader.MoveToFirstAttribute%2A>
- <xref:System.Xml.XmlReader.MoveToNextAttribute%2A>
- <xref:System.Xml.XmlReader.MoveToElement%2A>
- <xref:System.Xml.XmlReader.ReadAttributeValue%2A>
- <xref:System.Xml.XmlReader.ReadSubtree%2A>
- <xref:System.Xml.XmlReader.ResolveEntity%2A>
The following sections describe asynchronous usage for methods that don't have asynchronous counterparts.
**ReadStartElement method**
[!code-csharp[System.Xml.XmlReader.Class#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.xml.xmlreader.class/cs/program.cs#1)]
[!code-vb[System.Xml.XmlReader.Class#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.xml.xmlreader.class/vb/module1.vb#1)]
**ReadEndElement method**
[!code-csharp[System.Xml.XmlReader.Class#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.xml.xmlreader.class/cs/program.cs#2)]
[!code-vb[System.Xml.XmlReader.Class#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.xml.xmlreader.class/vb/module1.vb#2)]
**ReadToNextSibling method**
[!code-csharp[System.Xml.XmlReader.Class#3](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.xml.xmlreader.class/cs/program.cs#3)]
[!code-vb[System.Xml.XmlReader.Class#3](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.xml.xmlreader.class/vb/module1.vb#3)]
**ReadToFollowing method**
[!code-csharp[System.Xml.XmlReader.Class#4](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.xml.xmlreader.class/cs/program.cs#4)]
[!code-vb[System.Xml.XmlReader.Class#4](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.xml.xmlreader.class/vb/module1.vb#4)]
**ReadToDescendant method**
[!code-csharp[System.Xml.XmlReader.Class#5](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.xml.xmlreader.class/cs/program.cs#5)]
[!code-vb[System.Xml.XmlReader.Class#5](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.xml.xmlreader.class/vb/module1.vb#5)]
<a name="xmlreader_security"></a>
## Security considerations
Consider the following when working with the <xref:System.Xml.XmlReader> class:
- Exceptions thrown from the <xref:System.Xml.XmlReader> can disclose path information that you might not want bubbled up to your app. Your app must catch exceptions and process them appropriately.
- Do not enable DTD processing if you're concerned about denial of service issues or if you're dealing with untrusted sources. DTD processing is disabled by default for <xref:System.Xml.XmlReader> objects created by the <xref:System.Xml.XmlReader.Create%2A> method.
If you have DTD processing enabled, you can use the <xref:System.Xml.XmlSecureResolver> to restrict the resources that the <xref:System.Xml.XmlReader> can access. You can also design your app so that the XML processing is memory and time constrained. For example, you can configure time-out limits in your ASP.NET app.
- XML data can include references to external resources such as a schema file. By default, external resources are resolved by using an <xref:System.Xml.XmlUrlResolver> object with no user credentials. You can secure this further by doing one of the following:
- Restrict the resources that the <xref:System.Xml.XmlReader> can access by setting the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property to an <xref:System.Xml.XmlSecureResolver> object.
- Do not allow the <xref:System.Xml.XmlReader> to open any external resources by setting the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property to `null`.
- The <xref:System.Xml.Schema.XmlSchemaValidationFlags.ProcessInlineSchema> and <xref:System.Xml.Schema.XmlSchemaValidationFlags.ProcessSchemaLocation> validation flags of an <xref:System.Xml.XmlReaderSettings> object aren't set by default. This helps to protect the <xref:System.Xml.XmlReader> against schema-based attacks when it is processing XML data from an untrusted source. When these flags are set, the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A> of the <xref:System.Xml.XmlReaderSettings> object is used to resolve schema locations encountered in the instance document in the <xref:System.Xml.XmlReader>. If the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A> property is set to `null`, schema locations aren't resolved even if the <xref:System.Xml.Schema.XmlSchemaValidationFlags.ProcessInlineSchema> and <xref:System.Xml.Schema.XmlSchemaValidationFlags.ProcessSchemaLocation> 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 <xref:System.Xml.Schema.XmlSchemaValidationFlags.ProcessIdentityConstraints> flag when validating untrusted, large XML documents in high availability scenarios against a schema that has identity constraints over a large part of the document. This flag is enabled by default.
- 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 <xref:System.Xml.XmlReader>, you can:
- Limit the size of the document by setting the <xref:System.Xml.XmlReaderSettings.MaxCharactersInDocument%2A> property.
- Limit the number of characters that result from expanding entities by setting the <xref:System.Xml.XmlReaderSettings.MaxCharactersFromEntities%2A> property.
- Create a custom `IStream` implementation for the <xref:System.Xml.XmlReader>.
- The <xref:System.Xml.XmlReader.ReadValueChunk%2A> 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 <xref:System.Xml.XmlReader>, and you call the <xref:System.Xml.XmlReader.LocalName%2A>, <xref:System.Xml.XmlReader.Prefix%2A>, or <xref:System.Xml.XmlReader.NamespaceURI%2A> property for each item, the returned string is added to a <xref:System.Xml.NameTable>. The collection held by the <xref:System.Xml.NameTable> never decreases in size, creating a virtual memory leak of the string handles. One mitigation for this is to derive from the <xref:System.Xml.NameTable> class and enforce a maximum size quota. (There is no way to prevent the use of a <xref:System.Xml.NameTable>, or to switch the <xref:System.Xml.NameTable> when it is full). Another mitigation is to avoid using the properties mentioned and instead use the <xref:System.Xml.XmlReader.MoveToAttribute%2A> method with the <xref:System.Xml.XmlReader.IsStartElement%2A> method where possible; those methods don't return strings and thus avoid the problem of overfilling the <xref:System.Xml.NameTable> collection.
- <xref:System.Xml.XmlReaderSettings> objects can contain sensitive information such as user credentials. An untrusted component could use the <xref:System.Xml.XmlReaderSettings> object and its user credentials to create <xref:System.Xml.XmlReader> objects to read data. Be careful when caching <xref:System.Xml.XmlReaderSettings> objects, or when passing the <xref:System.Xml.XmlReaderSettings> object from one component to another.
- Do not accept supporting components, such as <xref:System.Xml.NameTable>, <xref:System.Xml.XmlNamespaceManager>, and <xref:System.Xml.XmlResolver> objects, from an untrusted source.
## Examples
The following example code shows how to use the asynchronous API to parse XML.
[!code-csharp[System.Xml.XmlReader.Class#6](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.xml.xmlreader.class/cs/program.cs#6)]
[!code-vb[System.Xml.XmlReader.Class#6](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.xml.xmlreader.class/vb/module1.vb#6)]
]]></format>
</remarks>
<related type="Article" href="~/docs/standard/data/xml/index.md">XML Documents and Data</related>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected XmlReader ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.#ctor" />
<MemberSignature Language="VB.NET" Value="Protected Sub New ()" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; XmlReader();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see langword="XmlReader" /> class.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This constructor is called by derived class constructors to initialize state in this type.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="AttributeCount">
<MemberSignature Language="C#" Value="public abstract int AttributeCount { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 AttributeCount" />
<MemberSignature Language="DocId" Value="P:System.Xml.XmlReader.AttributeCount" />
<MemberSignature Language="VB.NET" Value="Public MustOverride ReadOnly Property AttributeCount As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; abstract property int AttributeCount { int get(); };" />
<MemberSignature Language="F#" Value="member this.AttributeCount : int" Usage="System.Xml.XmlReader.AttributeCount" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>When overridden in a derived class, gets the number of attributes on the current node.</summary>
<value>The number of attributes on the current node.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property is relevant to `Element`, `DocumentType` and `XmlDeclaration` nodes only. (Other node types do not have attributes.)
## Examples
The following example displays all attributes on the current node.
[!code-csharp[XmlReaderBasic#1](~/samples/snippets/csharp/VS_Snippets_Data/XmlReaderBasic/CS/XmlReader_Basic.cs#1)]
[!code-vb[XmlReaderBasic#1](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReaderBasic/VB/xmlreader_basic.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
</Docs>
</Member>
<Member MemberName="BaseURI">
<MemberSignature Language="C#" Value="public abstract string BaseURI { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance string BaseURI" />
<MemberSignature Language="DocId" Value="P:System.Xml.XmlReader.BaseURI" />
<MemberSignature Language="VB.NET" Value="Public MustOverride ReadOnly Property BaseURI As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; abstract property System::String ^ BaseURI { System::String ^ get(); };" />
<MemberSignature Language="F#" Value="member this.BaseURI : string" Usage="System.Xml.XmlReader.BaseURI" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>When overridden in a derived class, gets the base URI of the current node.</summary>
<value>The base URI of the current node.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
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.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
</Docs>
</Member>
<Member MemberName="CanReadBinaryContent">
<MemberSignature Language="C#" Value="public virtual bool CanReadBinaryContent { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool CanReadBinaryContent" />
<MemberSignature Language="DocId" Value="P:System.Xml.XmlReader.CanReadBinaryContent" />
<MemberSignature Language="VB.NET" Value="Public Overridable ReadOnly Property CanReadBinaryContent As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property bool CanReadBinaryContent { bool get(); };" />
<MemberSignature Language="F#" Value="member this.CanReadBinaryContent : bool" Usage="System.Xml.XmlReader.CanReadBinaryContent" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating whether the <see cref="T:System.Xml.XmlReader" /> implements the binary content read methods.</summary>
<value>
<see langword="true" /> if the binary content read methods are implemented; otherwise <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The binary content read methods include the <xref:System.Xml.XmlReader.ReadContentAsBase64%2A>, <xref:System.Xml.XmlReader.ReadContentAsBinHex%2A>, <xref:System.Xml.XmlReader.ReadElementContentAsBase64%2A>, and <xref:System.Xml.XmlReader.ReadElementContentAsBinHex%2A> methods. If this property returns `false` a <xref:System.NotSupportedException> is returned when any of the binary read methods is called.
All Microsoft .NET Framework implementations of the <xref:System.Xml.XmlReader> class return `true` for this property.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
</Docs>
</Member>
<Member MemberName="CanReadValueChunk">
<MemberSignature Language="C#" Value="public virtual bool CanReadValueChunk { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool CanReadValueChunk" />
<MemberSignature Language="DocId" Value="P:System.Xml.XmlReader.CanReadValueChunk" />
<MemberSignature Language="VB.NET" Value="Public Overridable ReadOnly Property CanReadValueChunk As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property bool CanReadValueChunk { bool get(); };" />
<MemberSignature Language="F#" Value="member this.CanReadValueChunk : bool" Usage="System.Xml.XmlReader.CanReadValueChunk" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating whether the <see cref="T:System.Xml.XmlReader" /> implements the <see cref="M:System.Xml.XmlReader.ReadValueChunk(System.Char[],System.Int32,System.Int32)" /> method.</summary>
<value>
<see langword="true" /> if the <see cref="T:System.Xml.XmlReader" /> implements the <see cref="M:System.Xml.XmlReader.ReadValueChunk(System.Char[],System.Int32,System.Int32)" /> method; otherwise <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Text parsing <xref:System.Xml.XmlReader> objects that were created from the static <xref:System.Xml.XmlReader.Create%2A> method always return `true`. All other Microsoft .NET Framework implementations of the <xref:System.Xml.XmlReader> class, including the <xref:System.Xml.XmlTextReader> class, return `false`.
If this property returns `false` a <xref:System.NotSupportedException> is returned when the <xref:System.Xml.XmlReader.ReadValueChunk%2A> method is called.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
</Docs>
</Member>
<Member MemberName="CanResolveEntity">
<MemberSignature Language="C#" Value="public virtual bool CanResolveEntity { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool CanResolveEntity" />
<MemberSignature Language="DocId" Value="P:System.Xml.XmlReader.CanResolveEntity" />
<MemberSignature Language="VB.NET" Value="Public Overridable ReadOnly Property CanResolveEntity As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property bool CanResolveEntity { bool get(); };" />
<MemberSignature Language="F#" Value="member this.CanResolveEntity : bool" Usage="System.Xml.XmlReader.CanResolveEntity" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating whether this reader can parse and resolve entities.</summary>
<value>
<see langword="true" /> if the reader can parse and resolve entities; otherwise, <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property always returns `false` for implementations of <xref:System.Xml.XmlReader> that do not support DTD information. In this case, calling <xref:System.Xml.XmlReader.ResolveEntity%2A> throws an exception.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
</Docs>
</Member>
<Member MemberName="Close">
<MemberSignature Language="C#" Value="public virtual void Close ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Close() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.Close" />
<MemberSignature Language="VB.NET" Value="Public Overridable Sub Close ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual void Close();" />
<MemberSignature Language="F#" Value="abstract member Close : unit -&gt; unit&#xA;override this.Close : unit -&gt; unit" Usage="xmlReader.Close " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>When overridden in a derived class, changes the <see cref="P:System.Xml.XmlReader.ReadState" /> to <see cref="F:System.Xml.ReadState.Closed" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method also releases any resources held during reading. If <xref:System.Xml.XmlReader.Close%2A> has already been called, no action is performed.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
</Docs>
</Member>
<MemberGroup MemberName="Create">
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Creates a new <see cref="T:System.Xml.XmlReader" /> instance.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Most of the <xref:System.Xml.XmlReader.Create%2A> overloads include a `settings` parameter that accepts an <xref:System.Xml.XmlReaderSettings> object. You can use this object to:
- Specify which features you want supported on the <xref:System.Xml.XmlReader> object.
- Reuse the <xref:System.Xml.XmlReaderSettings> object to create multiple readers. You can use the same settings to create multiple readers with the same functionality. Or, you can modify the settings on an <xref:System.Xml.XmlReaderSettings> instance and create a new reader with a different set of features.
- Add features to an existing XML reader. The <xref:System.Xml.XmlReader.Create%2A> method can accept another <xref:System.Xml.XmlReader> object. The underlying <xref:System.Xml.XmlReader> object can be a user-defined reader, a <xref:System.Xml.XmlTextReader> object, or another <xref:System.Xml.XmlReader> instance that you want to add additional features to.
- Take full advantage of features such as better conformance checking and compliance to the [XML 1.0 (fourth edition)](https://www.w3.org/TR/2006/REC-xml-20060816/) recommendation that are available only on <xref:System.Xml.XmlReader> objects created by the static <xref:System.Xml.XmlReader.Create%2A> method.
> [!NOTE]
> Although the .NET Framework includes concrete implementations of the <xref:System.Xml.XmlReader> class, such as the <xref:System.Xml.XmlTextReader>, <xref:System.Xml.XmlNodeReader>, and the <xref:System.Xml.XmlValidatingReader> classes, we recommend that you create <xref:System.Xml.XmlReader> instances by using the <xref:System.Xml.XmlReader.Create%2A> method.
## Default settings
If you use a <xref:System.Xml.XmlReader.Create%2A> overload that doesn't accept a <xref:System.Xml.XmlReaderSettings> object, the following default reader settings are used:
|Setting|Default|
|-------------|-------------|
|<xref:System.Xml.XmlReaderSettings.CheckCharacters%2A>|`true`|
|<xref:System.Xml.XmlReaderSettings.ConformanceLevel%2A>|<xref:System.Xml.ConformanceLevel.Document?displayProperty=nameWithType>|
|<xref:System.Xml.XmlReaderSettings.IgnoreComments%2A>|`false`|
|<xref:System.Xml.XmlReaderSettings.IgnoreProcessingInstructions%2A>|`false`|
|<xref:System.Xml.XmlReaderSettings.IgnoreWhitespace%2A>|`false`|
|<xref:System.Xml.XmlReaderSettings.LineNumberOffset%2A>|0|
|<xref:System.Xml.XmlReaderSettings.LinePositionOffset%2A>|0|
|<xref:System.Xml.XmlReaderSettings.NameTable%2A>|`null`|
|<xref:System.Xml.XmlReaderSettings.DtdProcessing%2A>|<xref:System.Xml.DtdProcessing.Prohibit>|
|<xref:System.Xml.XmlReaderSettings.Schemas%2A>|An empty <xref:System.Xml.Schema.XmlSchemaSet> object|
|<xref:System.Xml.XmlReaderSettings.ValidationFlags%2A>|<xref:System.Xml.Schema.XmlSchemaValidationFlags.ProcessIdentityConstraints> enabled|
|<xref:System.Xml.XmlReaderSettings.ValidationType%2A>|<xref:System.Xml.ValidationType.None>|
|<xref:System.Xml.XmlReaderSettings.XmlResolver%2A>|A new <xref:System.Xml.XmlUrlResolver> object. Starting with the .NET Framework 4.5.2, this setting has a default value of `null`.|
## Settings for common scenarios
Here are the <xref:System.Xml.XmlReaderSettings> properties you should set for some of the typical XML reader scenarios.
|Requirement|Set|
|-----------------|---------|
|Data must be a well-formed XML document.|<xref:System.Xml.XmlReaderSettings.ConformanceLevel%2A> to <xref:System.Xml.ConformanceLevel.Document>.|
|Data must be a well-formed XML parsed entity.|<xref:System.Xml.XmlReaderSettings.ConformanceLevel%2A> to <xref:System.Xml.ConformanceLevel.Fragment>.|
|Data must be validated against a DTD.|<xref:System.Xml.XmlReaderSettings.DtdProcessing%2A> to <xref:System.Xml.DtdProcessing.Parse><br /><xref:System.Xml.XmlReaderSettings.ValidationType%2A> to <xref:System.Xml.ValidationType.DTD>.|
|Data must be validated against an XML schema.|<xref:System.Xml.XmlReaderSettings.ValidationType%2A> to <xref:System.Xml.ValidationType.Schema><br /><xref:System.Xml.XmlReaderSettings.Schemas%2A> to the <xref:System.Xml.Schema.XmlSchemaSet> to use for validation. Note that <xref:System.Xml.XmlReader> doesn't support XML-Data Reduced (XDR) schema validation.|
|Data must be validated against an inline XML schema.|<xref:System.Xml.XmlReaderSettings.ValidationType%2A> to <xref:System.Xml.ValidationType.Schema><br /><xref:System.Xml.XmlReaderSettings.ValidationFlags%2A> to <xref:System.Xml.Schema.XmlSchemaValidationFlags.ProcessInlineSchema>.|
|Type support.|<xref:System.Xml.XmlReaderSettings.ValidationType%2A> to <xref:System.Xml.ValidationType.Schema><br /><xref:System.Xml.XmlReaderSettings.Schemas%2A> to the <xref:System.Xml.Schema.XmlSchemaSet> to use.|
<xref:System.Xml.XmlReader> doesn't support XML-Data Reduced (XDR) schema validation.
## Asynchronous programming
In synchronous mode, the <xref:System.Xml.XmlReader.Create%2A> method reads the first chunk of data from the buffer of the file, stream, or text reader. This may throw an exception if an I/O operation fails. In asynchronous mode, the first I/O operation occurs with a read operation, so exceptions that arise will be thrown when the read operation occurs.
## Security considerations
By default, the <xref:System.Xml.XmlReader> uses an <xref:System.Xml.XmlUrlResolver> object with no user credentials to open resources. This means that, by default, the XML reader can access any location that doesn't require credentials. Use the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A> property to control access to resources:
- Set <xref:System.Xml.XmlReaderSettings.XmlResolver%2A> to an <xref:System.Xml.XmlSecureResolver> object to restrict the resources that the XML reader can access.
-or-
- Set <xref:System.Xml.XmlReaderSettings.XmlResolver%2A> to `null` to prevent the XML reader from opening any external resources.
## Examples
This example creates an XML reader that strips insignificant white space, strips comments, and performs fragment-level conformance checking.
[!code-csharp[XmlReader.Create#11](~/samples/snippets/csharp/VS_Snippets_Data/XmlReader.Create/CS/XmlReader_Create.cs#11)]
[!code-vb[XmlReader.Create#11](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReader.Create/VB/XmlReader_Create.vb#11)]
The following example uses an <xref:System.Xml.XmlUrlResolver> with default credentials to access a file.
[!code-cpp[XmlReaderSettings.cctor#1](~/samples/snippets/cpp/VS_Snippets_Data/XmlReaderSettings.cctor/CPP/XmlReaderSettings.cctor.cpp#1)]
[!code-csharp[XmlReaderSettings.cctor#1](~/samples/snippets/csharp/VS_Snippets_Data/XmlReaderSettings.cctor/CS/factory_rdr_cctor2.cs#1)]
[!code-vb[XmlReaderSettings.cctor#1](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReaderSettings.cctor/VB/factory_rdr_cctor2.vb#1)]
[!code-cpp[XmlReaderSettings.cctor#2](~/samples/snippets/cpp/VS_Snippets_Data/XmlReaderSettings.cctor/CPP/XmlReaderSettings.cctor.cpp#2)]
[!code-csharp[XmlReaderSettings.cctor#2](~/samples/snippets/csharp/VS_Snippets_Data/XmlReaderSettings.cctor/CS/factory_rdr_cctor2.cs#2)]
[!code-vb[XmlReaderSettings.cctor#2](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReaderSettings.cctor/VB/factory_rdr_cctor2.vb#2)]
The following code wraps a reader instance within another reader.
[!code-csharp[XmlReader.Create#13](~/samples/snippets/csharp/VS_Snippets_Data/XmlReader.Create/CS/XmlReader_Create.cs#13)]
[!code-vb[XmlReader.Create#13](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReader.Create/VB/XmlReader_Create.vb#13)]
This example chains readers to add DTD and XML schema validation.
[!code-csharp[XmlReader.Create#12](~/samples/snippets/csharp/VS_Snippets_Data/XmlReader.Create/CS/XmlReader_Create.cs#12)]
[!code-vb[XmlReader.Create#12](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReader.Create/VB/XmlReader_Create.vb#12)]
]]></format>
</remarks>
</Docs>
</MemberGroup>
<Member MemberName="Create">
<MemberSignature Language="C#" Value="public static System.Xml.XmlReader Create (System.IO.Stream input);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Xml.XmlReader Create(class System.IO.Stream input) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.Create(System.IO.Stream)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function Create (input As Stream) As XmlReader" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static System::Xml::XmlReader ^ Create(System::IO::Stream ^ input);" />
<MemberSignature Language="F#" Value="static member Create : System.IO.Stream -&gt; System.Xml.XmlReader" Usage="System.Xml.XmlReader.Create input" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Xml.XmlReader</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="input" Type="System.IO.Stream" Index="0" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
</Parameters>
<Docs>
<param name="input">The stream that contains the XML data.
The <see cref="T:System.Xml.XmlReader" /> scans the first bytes of the stream looking for a byte order mark or other sign of encoding. When encoding is determined, the encoding is used to continue reading the stream, and processing continues parsing the input as a stream of (Unicode) characters.</param>
<summary>Creates a new <see cref="T:System.Xml.XmlReader" /> instance using the specified stream with default settings.</summary>
<returns>An object that is used to read the XML data in the stream.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
An <xref:System.Xml.XmlReaderSettings> 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 <xref:System.Xml.XmlReaderSettings> object as one of its arguments, and pass in an <xref:System.Xml.XmlReaderSettings> object with the correct settings.
A default <xref:System.Xml.XmlUrlResolver> with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on.
> [!IMPORTANT]
> Starting with the .NET Framework 4.5.2, no default <xref:System.Xml.XmlUrlResolver> is provided. If your solution targets the .NET Framework 4.5.2 or later versions, specify an <xref:System.Xml.XmlResolver> using the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property.
If the external resource is located on a network resource that requires authentication, specify an <xref:System.Xml.XmlResolver> with the necessary credentials using the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property.
The created <xref:System.Xml.XmlReader> object expands entity references and performs XML normalization of new line characters.
## Examples
The following example creates an <xref:System.Xml.XmlReader> object that reads from a <xref:System.IO.FileStream>.
[!code-csharp[XmlReader.Create#8](~/samples/snippets/csharp/VS_Snippets_Data/XmlReader.Create/CS/XmlReader_Create.cs#8)]
[!code-vb[XmlReader.Create#8](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReader.Create/VB/XmlReader_Create.vb#8)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="input" /> value is <see langword="null" />.</exception>
<exception cref="T:System.Security.SecurityException">The <see cref="T:System.Xml.XmlReader" /> does not have sufficient permissions to access the location of the XML data.</exception>
</Docs>
</Member>
<Member MemberName="Create">
<MemberSignature Language="C#" Value="public static System.Xml.XmlReader Create (System.IO.TextReader input);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Xml.XmlReader Create(class System.IO.TextReader input) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.Create(System.IO.TextReader)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function Create (input As TextReader) As XmlReader" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static System::Xml::XmlReader ^ Create(System::IO::TextReader ^ input);" />
<MemberSignature Language="F#" Value="static member Create : System.IO.TextReader -&gt; System.Xml.XmlReader" Usage="System.Xml.XmlReader.Create input" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Xml.XmlReader</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="input" Type="System.IO.TextReader" Index="0" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
</Parameters>
<Docs>
<param name="input">The text reader from which to read the XML data. A text reader returns a stream of Unicode characters, so the encoding specified in the XML declaration is not used by the XML reader to decode the data stream.</param>
<summary>Creates a new <see cref="T:System.Xml.XmlReader" /> instance by using the specified text reader.</summary>
<returns>An object that is used to read the XML data in the stream.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
An <xref:System.Xml.XmlReaderSettings> 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 <xref:System.Xml.XmlReaderSettings> object as one of its arguments, and pass in an <xref:System.Xml.XmlReaderSettings> object with the correct settings.
A default <xref:System.Xml.XmlUrlResolver> with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on.
> [!IMPORTANT]
> Starting with the .NET Framework 4.5.2, no default <xref:System.Xml.XmlUrlResolver> is provided. If your solution targets the .NET Framework 4.5.2 or later versions, specify an <xref:System.Xml.XmlResolver> using the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property.
If the external resource is located on a network resource that requires authentication, specify an <xref:System.Xml.XmlResolver> with the necessary credentials using the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property.
The created <xref:System.Xml.XmlReader> object expands entity references and performs XML normalization of new line characters.
## Examples
The following example uses the <xref:System.IO.StringReader> class to read an XML string.
[!code-csharp[XmlReader.Create#7](~/samples/snippets/csharp/VS_Snippets_Data/XmlReader.Create/CS/XmlReader_Create.cs#7)]
[!code-vb[XmlReader.Create#7](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReader.Create/VB/XmlReader_Create.vb#7)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="input" /> value is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="Create">
<MemberSignature Language="C#" Value="public static System.Xml.XmlReader Create (string inputUri);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Xml.XmlReader Create(string inputUri) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.Create(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function Create (inputUri As String) As XmlReader" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static System::Xml::XmlReader ^ Create(System::String ^ inputUri);" />
<MemberSignature Language="F#" Value="static member Create : string -&gt; System.Xml.XmlReader" Usage="System.Xml.XmlReader.Create inputUri" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Xml.XmlReader</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="inputUri" Type="System.String" Index="0" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
</Parameters>
<Docs>
<param name="inputUri">The URI for the file that contains the XML data. The <see cref="T:System.Xml.XmlUrlResolver" /> class is used to convert the path to a canonical data representation.</param>
<summary>Creates a new <see cref="T:System.Xml.XmlReader" /> instance with specified URI.</summary>
<returns>An object that is used to read the XML data in the stream.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
An <xref:System.Xml.XmlReaderSettings> 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 <xref:System.Xml.XmlReaderSettings> object as one of its arguments, and pass in an <xref:System.Xml.XmlReaderSettings> object with the correct settings.
A default <xref:System.Xml.XmlUrlResolver> with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on.
> [!IMPORTANT]
> Starting with the .NET Framework 4.5.2, no default <xref:System.Xml.XmlUrlResolver> is provided. If your solution targets the .NET Framework 4.5.2 or later versions, specify an <xref:System.Xml.XmlResolver> using the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property.
If the external resource is located on a network resource that requires authentication, specify an <xref:System.Xml.XmlResolver> with the necessary credentials using the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property.
The created <xref:System.Xml.XmlReader> object expands entity references and performs XML normalization of new line characters.
## Examples
The following example creates an <xref:System.Xml.XmlReader> object that reads XML data file specified by the URI.
[!code-csharp[XmlReader.Create#6](~/samples/snippets/csharp/VS_Snippets_Data/XmlReader.Create/CS/XmlReader_Create.cs#6)]
[!code-vb[XmlReader.Create#6](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReader.Create/VB/XmlReader_Create.vb#6)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="inputUri" /> value is <see langword="null" />.</exception>
<exception cref="T:System.Security.SecurityException">The <see cref="T:System.Xml.XmlReader" /> does not have sufficient permissions to access the location of the XML data.</exception>
<exception cref="T:System.IO.FileNotFoundException">The file identified by the URI does not exist.</exception>
<exception cref="T:System.UriFormatException">
<block subset="none" type="note">
<para>
In the <see href="https://go.microsoft.com/fwlink/?LinkID=247912">.NET for Windows Store apps</see> or the <see href="https://docs.microsoft.com/dotnet/standard/cross-platform/cross-platform-development-with-the-portable-class-library">Portable Class Library</see>, catch the base class exception, <see cref="T:System.FormatException" />, instead.
</para>
</block>
The URI format is not correct.</exception>
</Docs>
</Member>
<Member MemberName="Create">
<MemberSignature Language="C#" Value="public static System.Xml.XmlReader Create (System.IO.Stream input, System.Xml.XmlReaderSettings settings);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Xml.XmlReader Create(class System.IO.Stream input, class System.Xml.XmlReaderSettings settings) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.Create(System.IO.Stream,System.Xml.XmlReaderSettings)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function Create (input As Stream, settings As XmlReaderSettings) As XmlReader" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static System::Xml::XmlReader ^ Create(System::IO::Stream ^ input, System::Xml::XmlReaderSettings ^ settings);" />
<MemberSignature Language="F#" Value="static member Create : System.IO.Stream * System.Xml.XmlReaderSettings -&gt; System.Xml.XmlReader" Usage="System.Xml.XmlReader.Create (input, settings)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Xml.XmlReader</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="input" Type="System.IO.Stream" Index="0" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="settings" Type="System.Xml.XmlReaderSettings" Index="1" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
</Parameters>
<Docs>
<param name="input">The stream that contains the XML data.
The <see cref="T:System.Xml.XmlReader" /> scans the first bytes of the stream looking for a byte order mark or other sign of encoding. When encoding is determined, the encoding is used to continue reading the stream, and processing continues parsing the input as a stream of (Unicode) characters.</param>
<param name="settings">The settings for the new <see cref="T:System.Xml.XmlReader" /> instance. This value can be <see langword="null" />.</param>
<summary>Creates a new <see cref="T:System.Xml.XmlReader" /> instance with the specified stream and settings.</summary>
<returns>An object that is used to read the XML data in the stream.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default an <xref:System.Xml.XmlUrlResolver> with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on.
> [!IMPORTANT]
> Starting with the .NET Framework 4.5.2, no default <xref:System.Xml.XmlUrlResolver> is provided. If your solution targets the .NET Framework 4.5.2 or later versions, specify an <xref:System.Xml.XmlResolver> using the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property.
If the external resource is located on a network resource that requires authentication, use the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property to specify an <xref:System.Xml.XmlResolver> with the necessary credentials.
> [!IMPORTANT]
> You can use one of the following methods to control which resources the <xref:System.Xml.XmlReader> can access:
>
> - Restrict the resources that the <xref:System.Xml.XmlReader> can access by setting the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A> property to an <xref:System.Xml.XmlSecureResolver> object.
>
> -or-
>
> - Do not allow the <xref:System.Xml.XmlReader> to open any external resources by setting the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A> property to `null`.
The created <xref:System.Xml.XmlReader> object expands entity references and performs XML normalization of new line characters.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="input" /> value is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="Create">
<MemberSignature Language="C#" Value="public static System.Xml.XmlReader Create (System.IO.TextReader input, System.Xml.XmlReaderSettings settings);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Xml.XmlReader Create(class System.IO.TextReader input, class System.Xml.XmlReaderSettings settings) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.Create(System.IO.TextReader,System.Xml.XmlReaderSettings)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function Create (input As TextReader, settings As XmlReaderSettings) As XmlReader" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static System::Xml::XmlReader ^ Create(System::IO::TextReader ^ input, System::Xml::XmlReaderSettings ^ settings);" />
<MemberSignature Language="F#" Value="static member Create : System.IO.TextReader * System.Xml.XmlReaderSettings -&gt; System.Xml.XmlReader" Usage="System.Xml.XmlReader.Create (input, settings)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Xml.XmlReader</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="input" Type="System.IO.TextReader" Index="0" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="settings" Type="System.Xml.XmlReaderSettings" Index="1" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
</Parameters>
<Docs>
<param name="input">The text reader from which to read the XML data. A text reader returns a stream of Unicode characters, so the encoding specified in the XML declaration isn't used by the XML reader to decode the data stream.</param>
<param name="settings">The settings for the new <see cref="T:System.Xml.XmlReader" />. This value can be <see langword="null" />.</param>
<summary>Creates a new <see cref="T:System.Xml.XmlReader" /> instance by using the specified text reader and settings.</summary>
<returns>An object that is used to read the XML data in the stream.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default an <xref:System.Xml.XmlUrlResolver> with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on.
> [!IMPORTANT]
> Starting with the .NET Framework 4.5.2, no default <xref:System.Xml.XmlUrlResolver> is provided. If your solution targets the .NET Framework 4.5.2 or later versions, specify an <xref:System.Xml.XmlResolver> using the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property.
If the external resource is located on a network resource that requires authentication, use the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property to specify an <xref:System.Xml.XmlResolver> with the necessary credentials.
> [!IMPORTANT]
> You can use one of the following methods to control which resources the <xref:System.Xml.XmlReader> can access:
>
> - Restrict the resources that the <xref:System.Xml.XmlReader> can access by setting the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A> property to an <xref:System.Xml.XmlSecureResolver> object.
>
> -or-
>
> - Do not allow the <xref:System.Xml.XmlReader> to open any external resources by setting the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A> property to `null`.
The created <xref:System.Xml.XmlReader> object expands entity references and performs XML normalization of new line characters.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="input" /> value is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="Create">
<MemberSignature Language="C#" Value="public static System.Xml.XmlReader Create (string inputUri, System.Xml.XmlReaderSettings settings);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Xml.XmlReader Create(string inputUri, class System.Xml.XmlReaderSettings settings) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.Create(System.String,System.Xml.XmlReaderSettings)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function Create (inputUri As String, settings As XmlReaderSettings) As XmlReader" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static System::Xml::XmlReader ^ Create(System::String ^ inputUri, System::Xml::XmlReaderSettings ^ settings);" />
<MemberSignature Language="F#" Value="static member Create : string * System.Xml.XmlReaderSettings -&gt; System.Xml.XmlReader" Usage="System.Xml.XmlReader.Create (inputUri, settings)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Xml.XmlReader</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="inputUri" Type="System.String" Index="0" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="settings" Type="System.Xml.XmlReaderSettings" Index="1" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
</Parameters>
<Docs>
<param name="inputUri">The URI for the file containing the XML data. The <see cref="T:System.Xml.XmlResolver" /> object on the <see cref="T:System.Xml.XmlReaderSettings" /> object is used to convert the path to a canonical data representation. If <see cref="P:System.Xml.XmlReaderSettings.XmlResolver" /> is <see langword="null" />, a new <see cref="T:System.Xml.XmlUrlResolver" /> object is used.</param>
<param name="settings">The settings for the new <see cref="T:System.Xml.XmlReader" /> instance. This value can be <see langword="null" />.</param>
<summary>Creates a new <see cref="T:System.Xml.XmlReader" /> instance by using the specified URI and settings.</summary>
<returns>An object that is used to read the XML data in the stream.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default an <xref:System.Xml.XmlUrlResolver> with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on.
> [!IMPORTANT]
> Starting with the .NET Framework 4.5.2, no default <xref:System.Xml.XmlUrlResolver> is provided. If your solution targets the .NET Framework 4.5.2 or later versions, specify an <xref:System.Xml.XmlResolver> using the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property.
This means that the <xref:System.Xml.XmlReader> can access any locations that does not require authentication. If the external resource is located on a network resource that requires authentication, use the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property to specify an <xref:System.Xml.XmlResolver> with the necessary credentials.
> [!IMPORTANT]
> You can restrict the resources that the <xref:System.Xml.XmlReader> can access by setting the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A> property to an <xref:System.Xml.XmlSecureResolver> object.
The created <xref:System.Xml.XmlReader> object expands entity references and performs XML normalization of new line characters.
## Examples
The following example creates an <xref:System.Xml.XmlReader> object that supports document type definition (DTD) validation.
[!code-csharp[XmlReader.Create#3](~/samples/snippets/csharp/VS_Snippets_Data/XmlReader.Create/CS/XmlReader_Create.cs#3)]
[!code-vb[XmlReader.Create#3](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReader.Create/VB/XmlReader_Create.vb#3)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="inputUri" /> value is <see langword="null" />.</exception>
<exception cref="T:System.IO.FileNotFoundException">The file specified by the URI cannot be found.</exception>
<exception cref="T:System.UriFormatException">
<block subset="none" type="note">
<para>
In the <see href="https://go.microsoft.com/fwlink/?LinkID=247912">.NET for Windows Store apps</see> or the <see href="https://docs.microsoft.com/dotnet/standard/cross-platform/cross-platform-development-with-the-portable-class-library">Portable Class Library</see>, catch the base class exception, <see cref="T:System.FormatException" />, instead.
</para>
</block>
The URI format is not correct.</exception>
</Docs>
</Member>
<Member MemberName="Create">
<MemberSignature Language="C#" Value="public static System.Xml.XmlReader Create (System.Xml.XmlReader reader, System.Xml.XmlReaderSettings settings);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Xml.XmlReader Create(class System.Xml.XmlReader reader, class System.Xml.XmlReaderSettings settings) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.Create(System.Xml.XmlReader,System.Xml.XmlReaderSettings)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function Create (reader As XmlReader, settings As XmlReaderSettings) As XmlReader" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static System::Xml::XmlReader ^ Create(System::Xml::XmlReader ^ reader, System::Xml::XmlReaderSettings ^ settings);" />
<MemberSignature Language="F#" Value="static member Create : System.Xml.XmlReader * System.Xml.XmlReaderSettings -&gt; System.Xml.XmlReader" Usage="System.Xml.XmlReader.Create (reader, settings)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Xml.XmlReader</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="reader" Type="System.Xml.XmlReader" Index="0" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="settings" Type="System.Xml.XmlReaderSettings" Index="1" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
</Parameters>
<Docs>
<param name="reader">The object that you want to use as the underlying XML reader.</param>
<param name="settings">The settings for the new <see cref="T:System.Xml.XmlReader" /> instance.
The conformance level of the <see cref="T:System.Xml.XmlReaderSettings" /> object must either match the conformance level of the underlying reader, or it must be set to <see cref="F:System.Xml.ConformanceLevel.Auto" />.</param>
<summary>Creates a new <see cref="T:System.Xml.XmlReader" /> instance by using the specified XML reader and settings.</summary>
<returns>An object that is wrapped around the specified <see cref="T:System.Xml.XmlReader" /> object.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method allows you add additional features to an underlying <xref:System.Xml.XmlReader> object. The underlying <xref:System.Xml.XmlReader> object can be another <xref:System.Xml.XmlReader> object created by the <xref:System.Xml.XmlReader.Create%2A> method, or an <xref:System.Xml.XmlReader> object created using one of the concrete <xref:System.Xml.XmlReader> implementations.
A default <xref:System.Xml.XmlUrlResolver> with no credentials is used to access any external resources such as a schema.
> [!IMPORTANT]
> Starting with the .NET Framework 4.5.2, no default <xref:System.Xml.XmlUrlResolver> is provided. If your solution targets the .NET Framework 4.5.2 or later versions, specify an <xref:System.Xml.XmlResolver> using the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property.
If the external resource is located on a network resource that requires authentication, specify an <xref:System.Xml.XmlResolver> with the necessary credentials using the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property.
> [!IMPORTANT]
> You can use one of the following methods to control which resources the <xref:System.Xml.XmlReader> can access:
>
> - Restrict the resources that the <xref:System.Xml.XmlReader> can access by setting the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A> property to an <xref:System.Xml.XmlSecureResolver> object.
>
> -or-
>
> - Do not allow the <xref:System.Xml.XmlReader> to open any external resources by setting the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A> property to `null`.
The created <xref:System.Xml.XmlReader> object expands entity references and performs XML normalization of new line characters.
## Examples
The following example creates a validating <xref:System.Xml.XmlReader> object that is wrapped around an <xref:System.Xml.XmlNodeReader> object.
[!code-csharp[XmlReader.Create#5](~/samples/snippets/csharp/VS_Snippets_Data/XmlReader.Create/CS/XmlReader_Create.cs#5)]
[!code-vb[XmlReader.Create#5](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReader.Create/VB/XmlReader_Create.vb#5)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="reader" /> value is <see langword="null" />.</exception>
<exception cref="T:System.InvalidOperationException">If the <see cref="T:System.Xml.XmlReaderSettings" /> object specifies a conformance level that is not consistent with conformance level of the underlying reader.
-or-
The underlying <see cref="T:System.Xml.XmlReader" /> is in an <see cref="F:System.Xml.ReadState.Error" /> or <see cref="F:System.Xml.ReadState.Closed" /> state.</exception>
</Docs>
</Member>
<Member MemberName="Create">
<MemberSignature Language="C#" Value="public static System.Xml.XmlReader Create (System.IO.Stream input, System.Xml.XmlReaderSettings settings, string baseUri);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Xml.XmlReader Create(class System.IO.Stream input, class System.Xml.XmlReaderSettings settings, string baseUri) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.Create(System.IO.Stream,System.Xml.XmlReaderSettings,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function Create (input As Stream, settings As XmlReaderSettings, baseUri As String) As XmlReader" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static System::Xml::XmlReader ^ Create(System::IO::Stream ^ input, System::Xml::XmlReaderSettings ^ settings, System::String ^ baseUri);" />
<MemberSignature Language="F#" Value="static member Create : System.IO.Stream * System.Xml.XmlReaderSettings * string -&gt; System.Xml.XmlReader" Usage="System.Xml.XmlReader.Create (input, settings, baseUri)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Xml.XmlReader</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="input" Type="System.IO.Stream" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
<Parameter Name="settings" Type="System.Xml.XmlReaderSettings" Index="1" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
<Parameter Name="baseUri" Type="System.String" Index="2" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
</Parameters>
<Docs>
<param name="input">The stream that contains the XML data.
The <see cref="T:System.Xml.XmlReader" /> scans the first bytes of the stream looking for a byte order mark or other sign of encoding. When encoding is determined, the encoding is used to continue reading the stream, and processing continues parsing the input as a stream of (Unicode) characters.</param>
<param name="settings">The settings for the new <see cref="T:System.Xml.XmlReader" /> instance. This value can be <see langword="null" />.</param>
<param name="baseUri">The base URI for the entity or document being read. This value can be <see langword="null" />.
**Security Note** The base URI is used to resolve the relative URI of the XML document. Do not use a base URI from an untrusted source.</param>
<summary>Creates a new <see cref="T:System.Xml.XmlReader" /> instance using the specified stream, base URI, and settings.</summary>
<returns>An object that is used to read the XML data in the stream.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default an <xref:System.Xml.XmlUrlResolver> with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on.
> [!IMPORTANT]
> Starting with the .NET Framework 4.5.2, no default <xref:System.Xml.XmlUrlResolver> is provided. If your solution targets the .NET Framework 4.5.2 or later versions, specify an <xref:System.Xml.XmlResolver> using the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property.
If the external resource is located on a network resource that requires authentication, use the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property to specify an <xref:System.Xml.XmlResolver> with the necessary credentials.
> [!IMPORTANT]
> You can use one of the following methods to control which resources the <xref:System.Xml.XmlReader> can access:
>
> - Restrict the resources that the <xref:System.Xml.XmlReader> can access by setting the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A> property to an <xref:System.Xml.XmlSecureResolver> object.
>
> -or-
>
> - Do not allow the <xref:System.Xml.XmlReader> to open any external resources by setting the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A> property to `null`.
The created <xref:System.Xml.XmlReader> object expands entity references and performs XML normalization of new line characters.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="input" /> value is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="Create">
<MemberSignature Language="C#" Value="public static System.Xml.XmlReader Create (System.IO.Stream input, System.Xml.XmlReaderSettings settings, System.Xml.XmlParserContext inputContext);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Xml.XmlReader Create(class System.IO.Stream input, class System.Xml.XmlReaderSettings settings, class System.Xml.XmlParserContext inputContext) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.Create(System.IO.Stream,System.Xml.XmlReaderSettings,System.Xml.XmlParserContext)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function Create (input As Stream, settings As XmlReaderSettings, inputContext As XmlParserContext) As XmlReader" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static System::Xml::XmlReader ^ Create(System::IO::Stream ^ input, System::Xml::XmlReaderSettings ^ settings, System::Xml::XmlParserContext ^ inputContext);" />
<MemberSignature Language="F#" Value="static member Create : System.IO.Stream * System.Xml.XmlReaderSettings * System.Xml.XmlParserContext -&gt; System.Xml.XmlReader" Usage="System.Xml.XmlReader.Create (input, settings, inputContext)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Xml.XmlReader</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="input" Type="System.IO.Stream" Index="0" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="settings" Type="System.Xml.XmlReaderSettings" Index="1" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="inputContext" Type="System.Xml.XmlParserContext" Index="2" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
</Parameters>
<Docs>
<param name="input">The stream that contains the XML data.
The <see cref="T:System.Xml.XmlReader" /> scans the first bytes of the stream looking for a byte order mark or other sign of encoding. When encoding is determined, the encoding is used to continue reading the stream, and processing continues parsing the input as a stream of (Unicode) characters.</param>
<param name="settings">The settings for the new <see cref="T:System.Xml.XmlReader" /> instance. This value can be <see langword="null" />.</param>
<param name="inputContext">The context information required to parse the XML fragment. The context information can include the <see cref="T:System.Xml.XmlNameTable" /> to use, encoding, namespace scope, the current <c>xml:lang</c> and <c>xml:space</c> scope, base URI, and document type definition.
This value can be <see langword="null" />.</param>
<summary>Creates a new <see cref="T:System.Xml.XmlReader" /> instance using the specified stream, settings, and context information for parsing.</summary>
<returns>An object that is used to read the XML data in the stream.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default an <xref:System.Xml.XmlUrlResolver> with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on.
> [!IMPORTANT]
> Starting with the .NET Framework 4.5.2, no default <xref:System.Xml.XmlUrlResolver> is provided. If your solution targets the .NET Framework 4.5.2 or later versions, specify an <xref:System.Xml.XmlResolver> using the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property.
If the external resource is located on a network resource that requires authentication, use the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property to specify an <xref:System.Xml.XmlResolver> with the necessary credentials.
> [!IMPORTANT]
> You can use one of the following methods to control which resources the <xref:System.Xml.XmlReader> can access:
>
> - Restrict the resources that the <xref:System.Xml.XmlReader> can access by setting the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A> property to an <xref:System.Xml.XmlSecureResolver> object.
>
> -or-
>
> - Do not allow the <xref:System.Xml.XmlReader> to open any external resources by setting the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A> property to `null`.
The created <xref:System.Xml.XmlReader> object expands entity references and performs XML normalization of new line characters.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="input" /> value is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="Create">
<MemberSignature Language="C#" Value="public static System.Xml.XmlReader Create (System.IO.TextReader input, System.Xml.XmlReaderSettings settings, string baseUri);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Xml.XmlReader Create(class System.IO.TextReader input, class System.Xml.XmlReaderSettings settings, string baseUri) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.Create(System.IO.TextReader,System.Xml.XmlReaderSettings,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function Create (input As TextReader, settings As XmlReaderSettings, baseUri As String) As XmlReader" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static System::Xml::XmlReader ^ Create(System::IO::TextReader ^ input, System::Xml::XmlReaderSettings ^ settings, System::String ^ baseUri);" />
<MemberSignature Language="F#" Value="static member Create : System.IO.TextReader * System.Xml.XmlReaderSettings * string -&gt; System.Xml.XmlReader" Usage="System.Xml.XmlReader.Create (input, settings, baseUri)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Xml.XmlReader</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="input" Type="System.IO.TextReader" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
<Parameter Name="settings" Type="System.Xml.XmlReaderSettings" Index="1" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
<Parameter Name="baseUri" Type="System.String" Index="2" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
</Parameters>
<Docs>
<param name="input">The text reader from which to read the XML data. A text reader returns a stream of Unicode characters, so the encoding specified in the XML declaration isn't used by the <see cref="T:System.Xml.XmlReader" /> to decode the data stream.</param>
<param name="settings">The settings for the new <see cref="T:System.Xml.XmlReader" /> instance. This value can be <see langword="null" />.</param>
<param name="baseUri">The base URI for the entity or document being read. This value can be <see langword="null" />.
**Security Note** The base URI is used to resolve the relative URI of the XML document. Do not use a base URI from an untrusted source.</param>
<summary>Creates a new <see cref="T:System.Xml.XmlReader" /> instance by using the specified text reader, settings, and base URI.</summary>
<returns>An object that is used to read the XML data in the stream.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default an <xref:System.Xml.XmlUrlResolver> with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on.
> [!IMPORTANT]
> Starting with the .NET Framework 4.5.2, no default <xref:System.Xml.XmlUrlResolver> is provided. If your solution targets the .NET Framework 4.5.2 or later versions, specify an <xref:System.Xml.XmlResolver> using the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property.
If the external resource is located on a network resource that requires authentication, use the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property to specify an <xref:System.Xml.XmlResolver> with the necessary credentials.
> [!IMPORTANT]
> You can use one of the following methods to control which resources the <xref:System.Xml.XmlReader> can access:
>
> - Restrict the resources that the <xref:System.Xml.XmlReader> can access by setting the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A> property to an <xref:System.Xml.XmlSecureResolver> object.
>
> -or-
>
> - Do not allow the <xref:System.Xml.XmlReader> to open any external resources by setting the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A> property to `null`.
The created <xref:System.Xml.XmlReader> object expands entity references and performs XML normalization of new line characters.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="input" /> value is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="Create">
<MemberSignature Language="C#" Value="public static System.Xml.XmlReader Create (System.IO.TextReader input, System.Xml.XmlReaderSettings settings, System.Xml.XmlParserContext inputContext);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Xml.XmlReader Create(class System.IO.TextReader input, class System.Xml.XmlReaderSettings settings, class System.Xml.XmlParserContext inputContext) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.Create(System.IO.TextReader,System.Xml.XmlReaderSettings,System.Xml.XmlParserContext)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function Create (input As TextReader, settings As XmlReaderSettings, inputContext As XmlParserContext) As XmlReader" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static System::Xml::XmlReader ^ Create(System::IO::TextReader ^ input, System::Xml::XmlReaderSettings ^ settings, System::Xml::XmlParserContext ^ inputContext);" />
<MemberSignature Language="F#" Value="static member Create : System.IO.TextReader * System.Xml.XmlReaderSettings * System.Xml.XmlParserContext -&gt; System.Xml.XmlReader" Usage="System.Xml.XmlReader.Create (input, settings, inputContext)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Xml.XmlReader</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="input" Type="System.IO.TextReader" Index="0" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="settings" Type="System.Xml.XmlReaderSettings" Index="1" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="inputContext" Type="System.Xml.XmlParserContext" Index="2" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
</Parameters>
<Docs>
<param name="input">The text reader from which to read the XML data. A text reader returns a stream of Unicode characters, so the encoding specified in the XML declaration isn't used by the XML reader to decode the data stream.</param>
<param name="settings">The settings for the new <see cref="T:System.Xml.XmlReader" /> instance. This value can be <see langword="null" />.</param>
<param name="inputContext">The context information required to parse the XML fragment. The context information can include the <see cref="T:System.Xml.XmlNameTable" /> to use, encoding, namespace scope, the current <c>xml:lang</c> and <c>xml:space</c> scope, base URI, and document type definition.
This value can be <see langword="null" />.</param>
<summary>Creates a new <see cref="T:System.Xml.XmlReader" /> instance by using the specified text reader, settings, and context information for parsing.</summary>
<returns>An object that is used to read the XML data in the stream.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default an <xref:System.Xml.XmlUrlResolver> with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on.
> [!IMPORTANT]
> Starting with the .NET Framework 4.5.2, no default <xref:System.Xml.XmlUrlResolver> is provided. If your solution targets the .NET Framework 4.5.2 or later versions, specify an <xref:System.Xml.XmlResolver> using the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property.
If the external resource is located on a network resource that requires authentication, use the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property to specify an <xref:System.Xml.XmlResolver> with the necessary credentials.
> [!IMPORTANT]
> You can use one of the following methods to control which resources the <xref:System.Xml.XmlReader> can access:
>
> - Restrict the resources that the <xref:System.Xml.XmlReader> can access by setting the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A> property to an <xref:System.Xml.XmlSecureResolver> object.
>
> -or-
>
> - Do not allow the <xref:System.Xml.XmlReader> to open any external resources by setting the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A> property to `null`.
The created <xref:System.Xml.XmlReader> object expands entity references and performs XML normalization of new line characters.
## Examples
The following example creates an <xref:System.Xml.XmlReader> object that reads an XML fragment.
[!code-csharp[XmlReader.Create#1](~/samples/snippets/csharp/VS_Snippets_Data/XmlReader.Create/CS/XmlReader_Create.cs#1)]
[!code-vb[XmlReader.Create#1](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReader.Create/VB/XmlReader_Create.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="input" /> value is <see langword="null" />.</exception>
<exception cref="T:System.ArgumentException">The <see cref="P:System.Xml.XmlReaderSettings.NameTable" /> and <see cref="P:System.Xml.XmlParserContext.NameTable" /> properties both contain values. (Only one of these <see langword="NameTable" /> properties can be set and used).</exception>
</Docs>
</Member>
<Member MemberName="Create">
<MemberSignature Language="C#" Value="public static System.Xml.XmlReader Create (string inputUri, System.Xml.XmlReaderSettings settings, System.Xml.XmlParserContext inputContext);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Xml.XmlReader Create(string inputUri, class System.Xml.XmlReaderSettings settings, class System.Xml.XmlParserContext inputContext) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.Create(System.String,System.Xml.XmlReaderSettings,System.Xml.XmlParserContext)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function Create (inputUri As String, settings As XmlReaderSettings, inputContext As XmlParserContext) As XmlReader" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static System::Xml::XmlReader ^ Create(System::String ^ inputUri, System::Xml::XmlReaderSettings ^ settings, System::Xml::XmlParserContext ^ inputContext);" />
<MemberSignature Language="F#" Value="static member Create : string * System.Xml.XmlReaderSettings * System.Xml.XmlParserContext -&gt; System.Xml.XmlReader" Usage="System.Xml.XmlReader.Create (inputUri, settings, inputContext)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Xml.XmlReader</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="inputUri" Type="System.String" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
<Parameter Name="settings" Type="System.Xml.XmlReaderSettings" Index="1" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
<Parameter Name="inputContext" Type="System.Xml.XmlParserContext" Index="2" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
</Parameters>
<Docs>
<param name="inputUri">The URI for the file containing the XML data. The <see cref="T:System.Xml.XmlResolver" /> object on the <see cref="T:System.Xml.XmlReaderSettings" /> object is used to convert the path to a canonical data representation. If <see cref="P:System.Xml.XmlReaderSettings.XmlResolver" /> is <see langword="null" />, a new <see cref="T:System.Xml.XmlUrlResolver" /> object is used.</param>
<param name="settings">The settings for the new <see cref="T:System.Xml.XmlReader" /> instance. This value can be <see langword="null" />.</param>
<param name="inputContext">The context information required to parse the XML fragment. The context information can include the <see cref="T:System.Xml.XmlNameTable" /> to use, encoding, namespace scope, the current <c>xml:lang</c> and <c>xml:space</c> scope, base URI, and document type definition.
This value can be <see langword="null" />.</param>
<summary>Creates a new <see cref="T:System.Xml.XmlReader" /> instance by using the specified URI, settings, and context information for parsing.</summary>
<returns>An object that is used to read the XML data in the stream.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default an <xref:System.Xml.XmlUrlResolver> with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on.
> [!IMPORTANT]
> Starting with the .NET Framework 4.5.2, no default <xref:System.Xml.XmlUrlResolver> is provided. If your solution targets the .NET Framework 4.5.2 or later versions, specify an <xref:System.Xml.XmlResolver> using the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property.
This means that the <xref:System.Xml.XmlReader> can access any locations that does not require authentication. If the external resource is located on a network resource that requires authentication, use the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A?displayProperty=nameWithType> property to specify an <xref:System.Xml.XmlResolver> with the necessary credentials.
> [!IMPORTANT]
> You can restrict the resources that the <xref:System.Xml.XmlReader> can access by setting the <xref:System.Xml.XmlReaderSettings.XmlResolver%2A> property to an <xref:System.Xml.XmlSecureResolver> object.
The created <xref:System.Xml.XmlReader> object expands entity references and performs XML normalization of new line characters.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <see langword="inputUri" /> value is <see langword="null" />.</exception>
<exception cref="T:System.Security.SecurityException">The <see cref="T:System.Xml.XmlReader" /> does not have sufficient permissions to access the location of the XML data.</exception>
<exception cref="T:System.ArgumentException">The <see cref="P:System.Xml.XmlReaderSettings.NameTable" /> and <see cref="P:System.Xml.XmlParserContext.NameTable" /> properties both contain values. (Only one of these <see langword="NameTable" /> properties can be set and used).</exception>
<exception cref="T:System.IO.FileNotFoundException">The file specified by the URI cannot be found.</exception>
<exception cref="T:System.UriFormatException">The URI format is not correct.</exception>
</Docs>
</Member>
<Member MemberName="Depth">
<MemberSignature Language="C#" Value="public abstract int Depth { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 Depth" />
<MemberSignature Language="DocId" Value="P:System.Xml.XmlReader.Depth" />
<MemberSignature Language="VB.NET" Value="Public MustOverride ReadOnly Property Depth As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; abstract property int Depth { int get(); };" />
<MemberSignature Language="F#" Value="member this.Depth : int" Usage="System.Xml.XmlReader.Depth" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>When overridden in a derived class, gets the depth of the current node in the XML document.</summary>
<value>The depth of the current node in the XML document.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
See <xref:System.Xml.XmlTextReader.Depth%2A> (in the `XmlTextReader` class) for an example using this property.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
</Docs>
</Member>
<MemberGroup MemberName="Dispose">
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
<summary>Releases the resources used by the <see cref="T:System.Xml.XmlReader" /> class.</summary>
</Docs>
</MemberGroup>
<Member MemberName="Dispose">
<MemberSignature Language="C#" Value="public void Dispose ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Dispose() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.Dispose" />
<MemberSignature Language="VB.NET" Value="Public Sub Dispose ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual void Dispose();" />
<MemberSignature Language="F#" Value="abstract member Dispose : unit -&gt; unit&#xA;override this.Dispose : unit -&gt; unit" Usage="xmlReader.Dispose " />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.IDisposable.Dispose</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Releases all resources used by the current instance of the <see cref="T:System.Xml.XmlReader" /> class.</summary>
<remarks>To be added.</remarks>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
</Docs>
</Member>
<Member MemberName="Dispose">
<MemberSignature Language="C#" Value="protected virtual void Dispose (bool disposing);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void Dispose(bool disposing) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.Dispose(System.Boolean)" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Sub Dispose (disposing As Boolean)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual void Dispose(bool disposing);" />
<MemberSignature Language="F#" Value="abstract member Dispose : bool -&gt; unit&#xA;override this.Dispose : bool -&gt; unit" Usage="xmlReader.Dispose disposing" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="disposing" Type="System.Boolean" Index="0" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
</Parameters>
<Docs>
<param name="disposing">
<see langword="true" /> to release both managed and unmanaged resources; <see langword="false" /> to release only unmanaged resources.</param>
<summary>Releases the unmanaged resources used by the <see cref="T:System.Xml.XmlReader" /> and optionally releases the managed resources.</summary>
<remarks>To be added.</remarks>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
</Docs>
</Member>
<Member MemberName="EOF">
<MemberSignature Language="C#" Value="public abstract bool EOF { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool EOF" />
<MemberSignature Language="DocId" Value="P:System.Xml.XmlReader.EOF" />
<MemberSignature Language="VB.NET" Value="Public MustOverride ReadOnly Property EOF As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; abstract property bool EOF { bool get(); };" />
<MemberSignature Language="F#" Value="member this.EOF : bool" Usage="System.Xml.XmlReader.EOF" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>When overridden in a derived class, gets a value indicating whether the reader is positioned at the end of the stream.</summary>
<value>
<see langword="true" /> if the reader is positioned at the end of the stream; otherwise, <see langword="false" />.</value>
<remarks>To be added.</remarks>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
</Docs>
</Member>
<MemberGroup MemberName="GetAttribute">
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
<summary>When overridden in a derived class, gets the value of an attribute.</summary>
</Docs>
</MemberGroup>
<Member MemberName="GetAttribute">
<MemberSignature Language="C#" Value="public abstract string GetAttribute (int i);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance string GetAttribute(int32 i) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.GetAttribute(System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function GetAttribute (i As Integer) As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; abstract System::String ^ GetAttribute(int i);" />
<MemberSignature Language="F#" Value="abstract member GetAttribute : int -&gt; string" Usage="xmlReader.GetAttribute i" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="i" Type="System.Int32" />
</Parameters>
<Docs>
<param name="i">The index of the attribute. The index is zero-based. (The first attribute has index 0.)</param>
<summary>When overridden in a derived class, gets the value of the attribute with the specified index.</summary>
<returns>The value of the specified attribute. This method does not move the reader.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following example gets the value of the third attribute.
[!code-csharp[XmlReaderBasic#2](~/samples/snippets/csharp/VS_Snippets_Data/XmlReaderBasic/CS/XmlReader_Basic.cs#2)]
[!code-vb[XmlReaderBasic#2](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReaderBasic/VB/xmlreader_basic.vb#2)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="i" /> is out of range. It must be non-negative and less than the size of the attribute collection.</exception>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
</Docs>
</Member>
<Member MemberName="GetAttribute">
<MemberSignature Language="C#" Value="public abstract string GetAttribute (string name);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance string GetAttribute(string name) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.GetAttribute(System.String)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function GetAttribute (name As String) As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; abstract System::String ^ GetAttribute(System::String ^ name);" />
<MemberSignature Language="F#" Value="abstract member GetAttribute : string -&gt; string" Usage="xmlReader.GetAttribute name" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="name" Type="System.String" />
</Parameters>
<Docs>
<param name="name">The qualified name of the attribute.</param>
<summary>When overridden in a derived class, gets the value of the attribute with the specified <see cref="P:System.Xml.XmlReader.Name" />.</summary>
<returns>The value of the specified attribute. If the attribute is not found or the value is <see langword="String.Empty" />, <see langword="null" /> is returned.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
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")`
## Examples
The following example gets the value of the ISBN attribute.
[!code-csharp[XmlReaderBasic#3](~/samples/snippets/csharp/VS_Snippets_Data/XmlReaderBasic/CS/XmlReader_Basic.cs#3)]
[!code-vb[XmlReaderBasic#3](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReaderBasic/VB/xmlreader_basic.vb#3)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="name" /> is <see langword="null" />.</exception>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
</Docs>
</Member>
<Member MemberName="GetAttribute">
<MemberSignature Language="C#" Value="public abstract string GetAttribute (string name, string namespaceURI);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance string GetAttribute(string name, string namespaceURI) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.GetAttribute(System.String,System.String)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function GetAttribute (name As String, namespaceURI As String) As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; abstract System::String ^ GetAttribute(System::String ^ name, System::String ^ namespaceURI);" />
<MemberSignature Language="F#" Value="abstract member GetAttribute : string * string -&gt; string" Usage="xmlReader.GetAttribute (name, namespaceURI)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="name" Type="System.String" />
<Parameter Name="namespaceURI" Type="System.String" />
</Parameters>
<Docs>
<param name="name">The local name of the attribute.</param>
<param name="namespaceURI">The namespace URI of the attribute.</param>
<summary>When overridden in a derived class, gets the value of the attribute with the specified <see cref="P:System.Xml.XmlReader.LocalName" /> and <see cref="P:System.Xml.XmlReader.NamespaceURI" />.</summary>
<returns>The value of the specified attribute. If the attribute is not found or the value is <see langword="String.Empty" />, <see langword="null" /> is returned. This method does not move the reader.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The following XML contains an attribute in a specific namespace:
```xml
<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):
```csharp
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:
```csharp
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 <xref:System.Xml.XmlReader.Prefix%2A> property.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="name" /> is <see langword="null" />.</exception>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
</Docs>
</Member>
<Member MemberName="GetValueAsync">
<MemberSignature Language="C#" Value="public virtual System.Threading.Tasks.Task&lt;string&gt; GetValueAsync ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Threading.Tasks.Task`1&lt;string&gt; GetValueAsync() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.GetValueAsync" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function GetValueAsync () As Task(Of String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual System::Threading::Tasks::Task&lt;System::String ^&gt; ^ GetValueAsync();" />
<MemberSignature Language="F#" Value="abstract member GetValueAsync : unit -&gt; System.Threading.Tasks.Task&lt;string&gt;&#xA;override this.GetValueAsync : unit -&gt; System.Threading.Tasks.Task&lt;string&gt;" Usage="xmlReader.GetValueAsync " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Threading.Tasks.Task&lt;System.String&gt;</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Asynchronously gets the value of the current node.</summary>
<returns>The value of the current node.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
To use this method, you must set the <xref:System.Xml.XmlReaderSettings.Async%2A> flag to `true`.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">
An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress".
-or-
An <see cref="T:System.Xml.XmlReader" /> asynchronous method was called without setting the <see cref="P:System.Xml.XmlReaderSettings.Async" /> flag to <see langword="true" />. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "Set XmlReaderSettings.Async to true if you want to use Async Methods."</exception>
<related type="Article" href="https://msdn.microsoft.com/library/db854f91-ccef-4035-ae4d-0911fde808c7">Asynchronous Programming with Async and Await (C# and Visual Basic)</related>
</Docs>
</Member>
<Member MemberName="HasAttributes">
<MemberSignature Language="C#" Value="public virtual bool HasAttributes { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool HasAttributes" />
<MemberSignature Language="DocId" Value="P:System.Xml.XmlReader.HasAttributes" />
<MemberSignature Language="VB.NET" Value="Public Overridable ReadOnly Property HasAttributes As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property bool HasAttributes { bool get(); };" />
<MemberSignature Language="F#" Value="member this.HasAttributes : bool" Usage="System.Xml.XmlReader.HasAttributes" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating whether the current node has any attributes.</summary>
<value>
<see langword="true" /> if the current node has attributes; otherwise, <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following example displays all attributes on the current node.
[!code-csharp[XmlReaderBasic#6](~/samples/snippets/csharp/VS_Snippets_Data/XmlReaderBasic/CS/XmlReader_Basic.cs#6)]
[!code-vb[XmlReaderBasic#6](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReaderBasic/VB/xmlreader_basic.vb#6)]
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
</Docs>
</Member>
<Member MemberName="HasValue">
<MemberSignature Language="C#" Value="public virtual bool HasValue { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool HasValue" />
<MemberSignature Language="DocId" Value="P:System.Xml.XmlReader.HasValue" />
<MemberSignature Language="VB.NET" Value="Public Overridable ReadOnly Property HasValue As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property bool HasValue { bool get(); };" />
<MemberSignature Language="F#" Value="member this.HasValue : bool" Usage="System.Xml.XmlReader.HasValue" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>When overridden in a derived class, gets a value indicating whether the current node can have a <see cref="P:System.Xml.XmlReader.Value" />.</summary>
<value>
<see langword="true" /> if the node on which the reader is currently positioned can have a <see langword="Value" />; otherwise, <see langword="false" />. If <see langword="false" />, the node has a value of <see langword="String.Empty" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
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.|
## Examples
See <xref:System.Xml.XmlTextReader.HasValue%2A> (in the `XmlTextReader` class) for a sample using this method.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
</Docs>
</Member>
<Member MemberName="IsDefault">
<MemberSignature Language="C#" Value="public virtual bool IsDefault { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool IsDefault" />
<MemberSignature Language="DocId" Value="P:System.Xml.XmlReader.IsDefault" />
<MemberSignature Language="VB.NET" Value="Public Overridable ReadOnly Property IsDefault As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property bool IsDefault { bool get(); };" />
<MemberSignature Language="F#" Value="member this.IsDefault : bool" Usage="System.Xml.XmlReader.IsDefault" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>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.</summary>
<value>
<see langword="true" /> if the current node is an attribute whose value was generated from the default value defined in the DTD or schema; <see langword="false" /> if the attribute value was explicitly set.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
`IsDefault` always returns `false` for implementations of `XmlReader` that do not support schema or DTD information. This property applies only to an attribute node.
## Examples
The following example displays all attributes on the root element.
```csharp
using System;
using System.IO;
using System.Xml;
public class Sample
{
public static void Main(){
// Create the reader.
XmlReader reader = XmlReader.Create("book4.xml");
reader.MoveToContent();
// Display each of the attribute nodes, including default attributes.
while (reader.MoveToNextAttribute()){
if (reader.IsDefault)
Console.Write("(default attribute) ");
Console.WriteLine("{0} = {1}", reader.Name, reader.Value);
}
//Close the reader.
reader.Close();
}
} // End class
```
The example uses the following files as input.
`book4.xml`
```xml
<!DOCTYPE book SYSTEM 'book.dtd'>
<book ISBN = '1-861001-57-5'>
<title>Pride And Prejudice</title>
<price>19.95</price>
</book>
```
`book.dtd`
```
<!ELEMENT book (title,price)>
<!ATTLIST book
genre CDATA "novel"
ISBN CDATA #REQUIRED>
<!ELEMENT title (#PCDATA)>
<!ELEMENT price (#PCDATA)>
```
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
</Docs>
</Member>
<Member MemberName="IsEmptyElement">
<MemberSignature Language="C#" Value="public abstract bool IsEmptyElement { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool IsEmptyElement" />
<MemberSignature Language="DocId" Value="P:System.Xml.XmlReader.IsEmptyElement" />
<MemberSignature Language="VB.NET" Value="Public MustOverride ReadOnly Property IsEmptyElement As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; abstract property bool IsEmptyElement { bool get(); };" />
<MemberSignature Language="F#" Value="member this.IsEmptyElement : bool" Usage="System.Xml.XmlReader.IsEmptyElement" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>When overridden in a derived class, gets a value indicating whether the current node is an empty element (for example, <c>&lt;MyElement/&gt;</c>).</summary>
<value>
<see langword="true" /> if the current node is an element (<see cref="P:System.Xml.XmlReader.NodeType" /> equals <see langword="XmlNodeType.Element" />) that ends with <c>/&gt;</c>; otherwise, <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
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.
## Examples
The following example displays the text content of each element.
[!code-csharp[XmlReaderBasic#10](~/samples/snippets/csharp/VS_Snippets_Data/XmlReaderBasic/CS/XmlReader_Basic.cs#10)]
[!code-vb[XmlReaderBasic#10](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReaderBasic/VB/xmlreader_basic.vb#10)]
The example uses the file, `elems.xml`, as input.
[!code-xml[XML_Core_Files#3](~/samples/snippets/xml/VS_Snippets_Data/XML_Core_Files/XML/elems.xml#3)]
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
</Docs>
</Member>
<Member MemberName="IsName">
<MemberSignature Language="C#" Value="public static bool IsName (string str);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig bool IsName(string str) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.IsName(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function IsName (str As String) As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static bool IsName(System::String ^ str);" />
<MemberSignature Language="F#" Value="static member IsName : string -&gt; bool" Usage="System.Xml.XmlReader.IsName str" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="str" Type="System.String" />
</Parameters>
<Docs>
<param name="str">The name to validate.</param>
<summary>Returns a value indicating whether the string argument is a valid XML name.</summary>
<returns>
<see langword="true" /> if the name is valid; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method uses the [W3C XML 1.0 Recommendation](https://go.microsoft.com/fwlink/?LinkId=49863) to determine whether the name is valid.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="str" /> value is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="IsNameToken">
<MemberSignature Language="C#" Value="public static bool IsNameToken (string str);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig bool IsNameToken(string str) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.IsNameToken(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function IsNameToken (str As String) As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static bool IsNameToken(System::String ^ str);" />
<MemberSignature Language="F#" Value="static member IsNameToken : string -&gt; bool" Usage="System.Xml.XmlReader.IsNameToken str" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="str" Type="System.String" />
</Parameters>
<Docs>
<param name="str">The name token to validate.</param>
<summary>Returns a value indicating whether or not the string argument is a valid XML name token.</summary>
<returns>
<see langword="true" /> if it is a valid name token; otherwise <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method uses the [W3C XML 1.0 Recommendation](https://go.microsoft.com/fwlink/?LinkId=49863) to determine whether the name token is valid.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="str" /> value is <see langword="null" />.</exception>
</Docs>
</Member>
<MemberGroup MemberName="IsStartElement">
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
<summary>Tests if the current content node is a start tag.</summary>
</Docs>
</MemberGroup>
<Member MemberName="IsStartElement">
<MemberSignature Language="C#" Value="public virtual bool IsStartElement ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance bool IsStartElement() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.IsStartElement" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function IsStartElement () As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual bool IsStartElement();" />
<MemberSignature Language="F#" Value="abstract member IsStartElement : unit -&gt; bool&#xA;override this.IsStartElement : unit -&gt; bool" Usage="xmlReader.IsStartElement " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Calls <see cref="M:System.Xml.XmlReader.MoveToContent" /> and tests if the current content node is a start tag or empty element tag.</summary>
<returns>
<see langword="true" /> if <see cref="M:System.Xml.XmlReader.MoveToContent" /> finds a start tag or empty element tag; <see langword="false" /> if a node type other than <see langword="XmlNodeType.Element" /> was found.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
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.
## Examples
The following example displays the text content of each element.
[!code-csharp[XmlReaderBasic#10](~/samples/snippets/csharp/VS_Snippets_Data/XmlReaderBasic/CS/XmlReader_Basic.cs#10)]
[!code-vb[XmlReaderBasic#10](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReaderBasic/VB/xmlreader_basic.vb#10)]
The example uses the file, `elems.xml`, as input.
[!code-xml[XML_Core_Files#3](~/samples/snippets/xml/VS_Snippets_Data/XML_Core_Files/XML/elems.xml#3)]
]]></format>
</remarks>
<exception cref="T:System.Xml.XmlException">Incorrect XML is encountered in the input stream.</exception>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
<altmember cref="M:System.Xml.XmlReader.MoveToContent" />
</Docs>
</Member>
<Member MemberName="IsStartElement">
<MemberSignature Language="C#" Value="public virtual bool IsStartElement (string name);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance bool IsStartElement(string name) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.IsStartElement(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function IsStartElement (name As String) As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual bool IsStartElement(System::String ^ name);" />
<MemberSignature Language="F#" Value="abstract member IsStartElement : string -&gt; bool&#xA;override this.IsStartElement : string -&gt; bool" Usage="xmlReader.IsStartElement name" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="name" Type="System.String" />
</Parameters>
<Docs>
<param name="name">The string matched against the <see langword="Name" /> property of the element found.</param>
<summary>Calls <see cref="M:System.Xml.XmlReader.MoveToContent" /> and tests if the current content node is a start tag or empty element tag and if the <see cref="P:System.Xml.XmlReader.Name" /> property of the element found matches the given argument.</summary>
<returns>
<see langword="true" /> if the resulting node is an element and the <see langword="Name" /> property matches the specified string. <see langword="false" /> if a node type other than <see langword="XmlNodeType.Element" /> was found or if the element <see langword="Name" /> property does not match the specified string.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
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.
## Examples
The following example displays each price element.
[!code-csharp[XmlReaderBasic#17](~/samples/snippets/csharp/VS_Snippets_Data/XmlReaderBasic/CS/XmlReader_Basic.cs#17)]
[!code-vb[XmlReaderBasic#17](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReaderBasic/VB/xmlreader_basic.vb#17)]
]]></format>
</remarks>
<exception cref="T:System.Xml.XmlException">Incorrect XML is encountered in the input stream.</exception>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
<altmember cref="M:System.Xml.XmlReader.MoveToContent" />
</Docs>
</Member>
<Member MemberName="IsStartElement">
<MemberSignature Language="C#" Value="public virtual bool IsStartElement (string localname, string ns);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance bool IsStartElement(string localname, string ns) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.XmlReader.IsStartElement(System.String,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function IsStartElement (localname As String, ns As String) As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual bool IsStartElement(System::String ^ localname, System::String ^ ns);" />
<MemberSignature Language="F#" Value="abstract member IsStartElement : string * string -&gt; bool&#xA;override this.IsStartElement : string * string -&gt; bool" Usage="xmlReader.IsStartElement (localname, ns)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="localname" Type="System.String" />
<Parameter Name="ns" Type="System.String" />
</Parameters>
<Docs>
<param name="localname">The string to match against the <see langword="LocalName" /> property of the element found.</param>
<param name="ns">The string to match against the <see langword="NamespaceURI" /> property of the element found.</param>
<summary>Calls <see cref="M:System.Xml.XmlReader.MoveToContent" /> and tests if the current content node is a start tag or empty element tag and if the <see cref="P:System.Xml.XmlReader.LocalName" /> and <see cref="P:System.Xml.XmlReader.NamespaceURI" /> properties of the element found match the given strings.</summary>
<returns>
<see langword="true" /> if the resulting node is an element. <see langword="false" /> if a node type other than <see langword="XmlNodeType.Element" /> was found or if the <see langword="LocalName" /> and <see langword="NamespaceURI" /> properties of the element do not match the specified strings.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
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.
]]></format>
</remarks>
<exception cref="T:System.Xml.XmlException">Incorrect XML is encountered in the input stream.</exception>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
<altmember cref="M:System.Xml.XmlReader.MoveToContent" />
</Docs>
</Member>
<MemberGroup MemberName="Item">
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
<summary>When overridden in a derived class, gets the value of the attribute.</summary>
</Docs>
</MemberGroup>
<Member MemberName="Item">
<MemberSignature Language="C#" Value="public virtual string this[int i] { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance string Item(int32)" />
<MemberSignature Language="DocId" Value="P:System.Xml.XmlReader.Item(System.Int32)" />
<MemberSignature Language="VB.NET" Value="Default Public Overridable ReadOnly Property Item(i As Integer) As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::String ^ default[int] { System::String ^ get(int i); };" />
<MemberSignature Language="F#" Value="member this.Item(int) : string" Usage="System.Xml.XmlReader.Item" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="i" Type="System.Int32" />
</Parameters>
<Docs>
<param name="i">The index of the attribute.</param>
<summary>When overridden in a derived class, gets the value of the attribute with the specified index.</summary>
<value>The value of the specified attribute.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property does not move the reader.
## Examples
The following example displays all attributes on the current node.
[!code-csharp[XmlReaderBasic#1](~/samples/snippets/csharp/VS_Snippets_Data/XmlReaderBasic/CS/XmlReader_Basic.cs#1)]
[!code-vb[XmlReaderBasic#1](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReaderBasic/VB/xmlreader_basic.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
<altmember cref="M:System.Xml.XmlReader.GetAttribute(System.Int32)" />
</Docs>
</Member>
<Member MemberName="Item">
<MemberSignature Language="C#" Value="public virtual string this[string name] { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance string Item(string)" />
<MemberSignature Language="DocId" Value="P:System.Xml.XmlReader.Item(System.String)" />
<MemberSignature Language="VB.NET" Value="Default Public Overridable ReadOnly Property Item(name As String) As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::String ^ default[System::String ^] { System::String ^ get(System::String ^ name); };" />
<MemberSignature Language="F#" Value="member this.Item(string) : string" Usage="System.Xml.XmlReader.Item" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="name" Type="System.String" />
</Parameters>
<Docs>
<param name="name">The qualified name of the attribute.</param>
<summary>When overridden in a derived class, gets the value of the attribute with the specified <see cref="P:System.Xml.XmlReader.Name" />.</summary>
<value>The value of the specified attribute. If the attribute is not found, <see langword="null" /> is returned.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property 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["PUBLIC"]`
## Examples
The following example gets the value of the ISBN attribute.
[!code-csharp[XmlReaderBasic#7](~/samples/snippets/csharp/VS_Snippets_Data/XmlReaderBasic/CS/XmlReader_Basic.cs#7)]
[!code-vb[XmlReaderBasic#7](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlReaderBasic/VB/xmlreader_basic.vb#7)]
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlReader" /> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException" /> is thrown with the message "An asynchronous operation is already in progress."</exception>
<altmember cref="M:System.Xml.XmlReader.GetAttribute(System.String)" />
</Docs>
</Member>
<Member MemberName="Item">
<MemberSignature Language="C#" Value="public virtual string this[string name, string namespaceURI] { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance string Item(string, string)" />
<MemberSignature Language="DocId" Value="P:System.Xml.XmlReader.Item(System.String,System.String)" />
<MemberSignature Language="VB.NET" Value="Default Public Overridable ReadOnly Property Item(name As String, namespaceURI As String) As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::String ^ default[System::String ^, System::String ^] { System::String ^ get(System::String ^ name, System::String ^ namespaceURI); };" />
<MemberSignature Language="F#" Value="member this.Item(string * string) : string" Usage="System.Xml.XmlReader.Item" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="name" Type="System.String" />
<Parameter Name="namespaceURI" Type="System.String" />
</Parameters>
<Docs>
<param name="name">The local name of the attribute.</param>
<param name="namespaceURI">The namespace URI of the attribute.</param>
<summary>When overridden in a derived class, gets the value of the attribute with the specified <see cref="P:System.Xml.XmlReader.LocalName" /> and <see cref="P:System.Xml.XmlReader.NamespaceURI" />.</summary>
<value>The value of the specified attribute. If the attribute is not found, <see langword="null" /> is returned.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property does not move the reader.
]]></format>