XmlTextReader 類別

定義

表示提供快速、非快取、順向 (Forward-only) 存取 XML 資料的讀取器 (Reader)。Represents a reader that provides fast, non-cached, forward-only access to XML data.

從 .NET Framework 2.0 開始,建議您改用 XmlReader 類別。Starting with the .NET Framework 2.0, we recommend that you use the XmlReader class instead.

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

備註

注意

從 .NET Framework 2.0 開始,建議您 XmlReader 使用方法來建立實例,以利用 XmlReader.Create 新功能。Starting with the .NET Framework 2.0, we recommend that you create XmlReader instances by using the XmlReader.Create method to take advantage of new functionality.

XmlTextReader 提供 XML 資料資料流程的順向唯讀存取。XmlTextReader provides forward-only, read-only access to a stream of XML data. 所謂目前節點,是指讀取器定位所在的節點。The current node refers to the node on which the reader is positioned. 讀取器是使用任何 read 方法和屬性來反映目前節點的值。The reader is advanced using any of the read methods and properties reflect the value of the current node.

這個類別會執行 XmlReader 並符合 W3C 可延伸標記語言 (XML) (xml) 1.0 和 xml 建議中的命名空間。This class implements XmlReader and conforms to the W3C Extensible Markup Language (XML) 1.0 and the Namespaces in XML recommendations. XmlTextReader 提供下列功能:XmlTextReader provides the following functionality:

  • 強制採用格式正確的 XML 規則。Enforces the rules of well-formed XML.

  • XmlTextReader 不提供資料驗證。XmlTextReader does not provide data validation.

  • 檢查 DocumentType 節點的格式是否正確。Checks that DocumentType nodes are well-formed. XmlTextReader 檢查 DTD 的格式是否正確,但不使用 DTD 進行驗證。XmlTextReader checks the DTD for well-formedness, but does not validate using the DTD.

  • 若是節點,則會 NodeType XmlNodeType.EntityReference 傳回單一空白 EntityReference 節點 (也就是 Value String.Empty) 屬性。For nodes where NodeType is XmlNodeType.EntityReference, a single empty EntityReference node is returned (that is, the Value property is String.Empty).

注意

DTD 中實體的實際宣告稱為 Entity 節點。The actual declarations of entities in the DTD are called Entity nodes. 當您在資料中參考這些節點時,它們稱為 EntityReference 節點。When you refer to these nodes in your data, they are called EntityReference nodes.

  • 不會展開預設屬性。Does not expand default attributes.

因為不 XmlTextReader 會執行資料驗證所需的額外檢查,所以它會提供快速格式正確的剖析器。Because the XmlTextReader does not perform the extra checks required for data validation, it provides a fast well-formedness parser.

若要執行資料驗證,請使用驗證 XmlReaderTo perform data validation, use a validating XmlReader.

若要從讀取 XML 資料 XmlDocument ,請使用 XmlNodeReaderTo read XML data from an XmlDocument, use XmlNodeReader.

XmlTextReaderXmlException在 XML 剖析錯誤時擲回。XmlTextReader throws an 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 than the actual node type of the current node. ReadState 可以使用屬性來檢查讀取器是否處於錯誤狀態。Use the ReadState property to check whether a reader is in error state.

安全性考量Security Considerations

以下是使用類別時要考慮的事項 XmlTextReaderThe following are things to consider when using the XmlTextReader class.

  • 擲回的例外狀況 XmlTextReader 可能會洩漏您不想要向上升至應用程式的路徑資訊。Exceptions thrown the XmlTextReader can disclose path information that you do not want bubbled up to the application. 應用程式必須捕捉例外狀況並予以適當處理。Your applications must catch exceptions and process them appropriately.

  • DTD 處理預設會啟用。DTD processing is enabled by default. 如果您擔心拒絕服務問題,或您正在處理不受信任的來源,請停用 DTD 處理。Disable DTD processing if you are concerned about Denial of Service issues or if you are dealing with untrusted sources. DtdProcessing 屬性設為, Prohibit 以停用 DTD 處理。Set the DtdProcessing property to Prohibit to disable DTD processing.

    如果已啟用 DTD 處理,則可使用 XmlSecureResolver 限制 XmlTextReader 可存取的資源。If you have DTD processing enabled, you can use the XmlSecureResolver to restrict the resources that the XmlTextReader can access. 您還可以設計應用程式,讓 XML 處理具有記憶體和時間限制。You can also design your application so that the XML processing is memory and time constrained. 例如,在 ASP.NET 應用程式中設定逾時限制。For example, configure time-out limits in your ASP.NET application.

  • XML 資料可以包括外部資源(例如 DTD 檔案)的參考。XML data can include references to external resources such as a DTD file. 依預設,外部資源會使用不具使用者認證的 XmlUrlResolver 物件來解析。By default external resources are resolved using an XmlUrlResolver object with no user credentials. 您可以透過執行下列其中一項作業,進一步保護它:You can secure this further by doing one of the following:

  • XML 資料可以包含需要相當長時間來處理的大量屬性、命名空間宣告、巢狀項目等。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. 若要限制傳送至的輸入大小 XmlTextReader ,請建立自訂的 IStream 實作為,並為其提供 XmlTextReaderTo limit the size of the input that is sent to the XmlTextReader, create a custom IStream implementation and supply it the XmlTextReader.

  • ReadValueChunk方法可以用來處理大量資料的資料流程。The ReadValueChunk 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.

  • 依預設不會展開一般實體。By default general entities are not expanded. 當呼叫 ResolveEntity 方法時,會展開一般實體。General entities are expanded when you call the ResolveEntity method.

給繼承者的注意事項

此類別具有繼承要求。This class has an inheritance demand. 需要完全信任,才能繼承自 XmlTextReaderFull trust is required to inherit from XmlTextReader.

建構函式

XmlTextReader()

初始化 XmlTextReader 的新執行個體。Initializes a new instance of the XmlTextReader.

XmlTextReader(Stream)

使用指定的資料流初始化 XmlTextReader 類別的新執行個體。Initializes a new instance of the XmlTextReader class with the specified stream.

XmlTextReader(Stream, XmlNameTable)

使用指定的資料流和 XmlNameTable,初始化 XmlTextReader 類別的新執行個體。Initializes a new instance of the XmlTextReader class with the specified stream and XmlNameTable.

XmlTextReader(Stream, XmlNodeType, XmlParserContext)

使用指定的資料流、XmlNodeTypeXmlParserContext,初始化 XmlTextReader 類別的新執行個體。Initializes a new instance of the XmlTextReader class with the specified stream, XmlNodeType, and XmlParserContext.

XmlTextReader(String)

使用指定的檔案,初始化 XmlTextReader 類別的新執行個體。Initializes a new instance of the XmlTextReader class with the specified file.

XmlTextReader(String, Stream)

使用指定的 URL 和資料流,初始化 XmlTextReader 類別的新執行個體。Initializes a new instance of the XmlTextReader class with the specified URL and stream.

XmlTextReader(String, Stream, XmlNameTable)

使用指定的 URL、資料流和 XmlNameTable,初始化 XmlTextReader 類別的新執行個體。Initializes a new instance of the XmlTextReader class with the specified URL, stream and XmlNameTable.

XmlTextReader(String, TextReader)

使用指定的 URL 和 TextReader,初始化 XmlTextReader 類別的新執行個體。Initializes a new instance of the XmlTextReader class with the specified URL and TextReader.

XmlTextReader(String, TextReader, XmlNameTable)

使用指定的 URL、XmlTextReaderTextReader,初始化 XmlNameTable 類別的新執行個體。Initializes a new instance of the XmlTextReader class with the specified URL, TextReader and XmlNameTable.

XmlTextReader(String, XmlNameTable)

使用指定的檔案和 XmlNameTable,初始化 XmlTextReader 類別的新執行個體。Initializes a new instance of the XmlTextReader class with the specified file and XmlNameTable.

XmlTextReader(String, XmlNodeType, XmlParserContext)

使用指定的字串、XmlNodeTypeXmlParserContext,初始化 XmlTextReader 類別的新執行個體。Initializes a new instance of the XmlTextReader class with the specified string, XmlNodeType, and XmlParserContext.

XmlTextReader(TextReader)

使用指定的 XmlTextReader 初始化 TextReader 類別的新執行個體。Initializes a new instance of the XmlTextReader class with the specified TextReader.

XmlTextReader(TextReader, XmlNameTable)

使用指定的 XmlTextReaderTextReader,初始化 XmlNameTable 類別的新執行個體。Initializes a new instance of the XmlTextReader class with the specified TextReader and XmlNameTable.

XmlTextReader(XmlNameTable)

使用指定的 XmlTextReader 初始化 XmlNameTable 類別的新執行個體。Initializes a new instance of the XmlTextReader class with the specified XmlNameTable.

屬性

AttributeCount

取得目前節點的屬性數目。Gets the number of attributes on the current node.

BaseURI

取得目前節點的基底 (Base) URI。Gets the base URI of the current node.

CanReadBinaryContent

取得值,這個值表示 XmlTextReader 是否會實作二進位內容讀取方法。Gets a value indicating whether the XmlTextReader implements the binary content read methods.

CanReadBinaryContent

取得值,這個值表示 XmlReader 是否會實作二進位內容讀取方法。Gets a value indicating whether the XmlReader implements the binary content read methods.

(繼承來源 XmlReader)
CanReadValueChunk

取得值,表示 XmlTextReader 是否會實作 ReadValueChunk(Char[], Int32, Int32) 方法。Gets a value indicating whether the XmlTextReader implements the ReadValueChunk(Char[], Int32, Int32) method.

CanReadValueChunk

取得值,表示 XmlReader 是否會實作 ReadValueChunk(Char[], Int32, Int32) 方法。Gets a value indicating whether the XmlReader implements the ReadValueChunk(Char[], Int32, Int32) method.

(繼承來源 XmlReader)
CanResolveEntity

取得值,指出這個讀取器是否可以剖析和解析實體。Gets a value indicating whether this reader can parse and resolve entities.

CanResolveEntity

取得值,指出這個讀取器是否可以剖析和解析實體。Gets a value indicating whether this reader can parse and resolve entities.

(繼承來源 XmlReader)
Depth

取得 XML 文件中目前節點的深度。Gets the depth of the current node in the XML document.

DtdProcessing

取得或設定 DtdProcessing 列舉。Gets or sets the DtdProcessing enumeration.

Encoding

取得文件的編碼方式。Gets the encoding of the document.

EntityHandling

取得或設定值,表示讀取器如何處理實體。Gets or sets a value that specifies how the reader handles entities.

EOF

取得值,表示讀取器是否位於資料流結尾。Gets a value indicating whether the reader is positioned at the end of the stream.

HasAttributes

取得值,表示目前節點是否具有任何屬性。Gets a value indicating whether the current node has any attributes.

(繼承來源 XmlReader)
HasValue

取得值,表示目前的節點是否可以具有 String.Empty 之外的其他 ValueGets a value indicating whether the current node can have a Value other than String.Empty.

IsDefault

取得值,表示目前節點是否是產生自 DTD 或結構描述中定義之預設值的屬性。Gets a value indicating whether the current node is an attribute that was generated from the default value defined in the DTD or schema.

IsEmptyElement

取得值,指出目前的節點是否為空項目 (例如 <MyElement/>)。Gets a value indicating whether the current node is an empty element (for example, <MyElement/>).

Item[Int32]

取得具有指定索引的屬性值。Gets the value of the attribute with the specified index.

Item[Int32]

在衍生類別中覆寫時,取得具有指定索引的屬性值。When overridden in a derived class, gets the value of the attribute with the specified index.

(繼承來源 XmlReader)
Item[String, String]

取得具有指定的區域名稱和命名空間 URI 的屬性值。Gets the value of the attribute with the specified local name and namespace URI.

Item[String, String]

在衍生類別中覆寫時,取得具有指定 LocalNameNamespaceURI 的屬性值。When overridden in a derived class, gets the value of the attribute with the specified LocalName and NamespaceURI.

(繼承來源 XmlReader)
Item[String]

取得具有指定名稱的屬性值。Gets the value of the attribute with the specified name.

Item[String]

在衍生類別中覆寫時,取得具有指定 Name 的屬性值。When overridden in a derived class, gets the value of the attribute with the specified Name.

(繼承來源 XmlReader)
LineNumber

取得目前的行號。Gets the current line number.

LinePosition

取得目前的行位置。Gets the current line position.

LocalName

取得目前節點的區域名稱。Gets the local name of the current node.

Name

取得目前節點的限定名稱 (Qualified Name)。Gets the qualified name of the current node.

Namespaces

取得或設定值,指出是否支援命名空間。Gets or sets a value indicating whether to do namespace support.

NamespaceURI

取得讀取器所在節點的命名空間 URI (如 W3C 命名空間規格中所定義)。Gets the namespace URI (as defined in the W3C Namespace specification) of the node on which the reader is positioned.

NameTable

取得與這個實作關聯的 XmlNameTableGets the XmlNameTable associated with this implementation.

NodeType

取得目前節點的類型。Gets the type of the current node.

Normalization

取得或設定值,指示是否將空白字元與屬性值正常化。Gets or sets a value indicating whether to normalize white space and attribute values.

Prefix

取得與目前節點相關聯的命名空間前置詞。Gets the namespace prefix associated with the current node.

ProhibitDtd
已過時。

取得或設定值,指出是否允許 DTD 處理。Gets or sets a value indicating whether to allow DTD processing. 這個屬性已經過時。This property is obsolete. 請改用 DtdProcessingUse DtdProcessing instead.

QuoteChar

取得用來括住屬性節點值的引號字元。Gets the quotation mark character used to enclose the value of an attribute node.

ReadState

取得讀取器的狀態。Gets the state of the reader.

SchemaInfo

取得在結構描述驗證之後已指派給目前節點的結構描述資訊。Gets the schema information that has been assigned to the current node as a result of schema validation.

(繼承來源 XmlReader)
Settings

取得 XmlReaderSettings 物件,用於建立這個 XmlTextReader 執行個體。Gets the XmlReaderSettings object used to create this XmlTextReader instance.

Settings

取得 XmlReaderSettings 物件,用於建立這個 XmlReader 執行個體。Gets the XmlReaderSettings object used to create this XmlReader instance.

(繼承來源 XmlReader)
Value

取得目前節點的文字值。Gets the text value of the current node.

ValueType

取得目前節點的 Common Language Runtime (CLR) 型別。Gets The Common Language Runtime (CLR) type for the current node.

(繼承來源 XmlReader)
WhitespaceHandling

取得或設定值,指定如何處理空白字元。Gets or sets a value that specifies how white space is handled.

XmlLang

取得目前的 xml:lang 範圍。Gets the current xml:lang scope.

XmlResolver

設定用來解析 DTD 參考的 XmlResolverSets the XmlResolver used for resolving DTD references.

XmlSpace

取得目前的 xml:space 範圍。Gets the current xml:space scope.

方法

Close()

ReadState 變更為 ClosedChanges the ReadState to Closed.

Dispose()

釋放 XmlReader 類別目前的執行個體所使用的全部資源。Releases all resources used by the current instance of the XmlReader class.

(繼承來源 XmlReader)
Dispose(Boolean)

釋放 XmlReader 所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。Releases the unmanaged resources used by the XmlReader and optionally releases the managed resources.

(繼承來源 XmlReader)
Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetAttribute(Int32)

取得具有指定索引的屬性值。Gets the value of the attribute with the specified index.

GetAttribute(String)

取得具有指定名稱的屬性值。Gets the value of the attribute with the specified name.

GetAttribute(String, String)

取得具有指定的區域名稱和命名空間 URI 的屬性值。Gets the value of the attribute with the specified local name and namespace URI.

GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetNamespacesInScope(XmlNamespaceScope)

取得集合,包含目前範圍內的所有命名空間。Gets a collection that contains all namespaces currently in-scope.

GetRemainder()

取得已緩衝之 XML 的其他部分。Gets the remainder of the buffered XML.

GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
GetValueAsync()

非同步取得目前節點的值。Asynchronously gets the value of the current node.

(繼承來源 XmlReader)
HasLineInfo()

取得值,這個值指出類別是否可以傳回行資訊。Gets a value indicating whether the class can return line information.

IsStartElement()

呼叫 MoveToContent() 並測試目前的內容節點為開頭標記或空白項目標記。Calls MoveToContent() and tests if the current content node is a start tag or empty element tag.

(繼承來源 XmlReader)
IsStartElement(String)

呼叫 MoveToContent() 並測試目前的內容節點為開頭標記或空白項目標記,以及所找到項目的 Name 屬性是否符合指定的引數。Calls MoveToContent() and tests if the current content node is a start tag or empty element tag and if the Name property of the element found matches the given argument.

(繼承來源 XmlReader)
IsStartElement(String, String)

呼叫 MoveToContent() 並測試目前的內容節點為開頭標記或空白項目標記,以及所找到項目的 LocalNameNamespaceURI 屬性是否符合指定的字串。Calls MoveToContent() and tests if the current content node is a start tag or empty element tag and if the LocalName and NamespaceURI properties of the element found match the given strings.

(繼承來源 XmlReader)
LookupNamespace(String)

解析目前項目範圍中的命名空間前置詞。Resolves a namespace prefix in the current element's scope.

MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
MoveToAttribute(Int32)

移至具有指定索引的屬性。Moves to the attribute with the specified index.

MoveToAttribute(String)

移至具有指定名稱的屬性。Moves to the attribute with the specified name.

MoveToAttribute(String, String)

移至具有指定的區域名稱和命名空間 URI 的屬性。Moves to the attribute with the specified local name and namespace URI.

MoveToContent()

檢查目前節點是否為內容 (非空白字元文字、CDATAElementEndElementEntityReferenceEndEntity) 節點。Checks whether the current node is a content (non-white space text, CDATA, Element, EndElement, EntityReference, or EndEntity) node. 如果節點並非內容節點,讀取器會先跳至下一個內容節點或檔案結尾。If the node is not a content node, the reader skips ahead to the next content node or end of file. 它會略過下列型別的節點:ProcessingInstructionDocumentTypeCommentWhitespaceSignificantWhitespaceIt skips over nodes of the following type: ProcessingInstruction, DocumentType, Comment, Whitespace, or SignificantWhitespace.

(繼承來源 XmlReader)
MoveToContentAsync()

非同步檢查目前節點是否為內容節點。Asynchronously checks whether the current node is a content node. 如果節點並非內容節點,讀取器會先跳至下一個內容節點或檔案結尾。If the node is not a content node, the reader skips ahead to the next content node or end of file.

(繼承來源 XmlReader)
MoveToElement()

移至包含目前屬性節點的項目。Moves to the element that contains the current attribute node.

MoveToFirstAttribute()

移至第一個屬性。Moves to the first attribute.

MoveToNextAttribute()

移至下一個屬性。Moves to the next attribute.

Read()

從資料流讀取下一個節點。Reads the next node from the stream.

ReadAsync()

非同步讀取資料流中的下一個節點。Asynchronously reads the next node from the stream.

(繼承來源 XmlReader)
ReadAttributeValue()

將屬性值剖析成一或多個 TextEntityReferenceEndEntity 節點。Parses the attribute value into one or more Text, EntityReference, or EndEntity nodes.

ReadBase64(Byte[], Int32, Int32)

解碼 Base64 並傳回已解碼的二進位位元組。Decodes Base64 and returns the decoded binary bytes.

ReadBinHex(Byte[], Int32, Int32)

解碼 BinHex 並傳回已解碼的二進位位元組。Decodes BinHex and returns the decoded binary bytes.

ReadChars(Char[], Int32, Int32)

將項目的文字內容讀入字元緩衝區中。Reads the text contents of an element into a character buffer. 這個方法設計可藉由連續呼叫來讀取內嵌文字的大量資料流。This method is designed to read large streams of embedded text by calling it successively.

ReadContentAs(Type, IXmlNamespaceResolver)

以指定型别的物件形式讀取內容。Reads the content as an object of the type specified.

(繼承來源 XmlReader)
ReadContentAsAsync(Type, IXmlNamespaceResolver)

以非同步的方式讀取做為指定型别之物件的內容。Asynchronously reads the content as an object of the type specified.

(繼承來源 XmlReader)
ReadContentAsBase64(Byte[], Int32, Int32)

讀取內容,並傳回 Base64 已解碼的二進位位元組。Reads the content and returns the Base64 decoded binary bytes.

ReadContentAsBase64(Byte[], Int32, Int32)

讀取內容,並傳回 Base64 已解碼的二進位位元組。Reads the content and returns the Base64 decoded binary bytes.

(繼承來源 XmlReader)
ReadContentAsBase64Async(Byte[], Int32, Int32)

以非同步的方式讀取內容,並傳回 Base64 已解碼的二進位位元組。Asynchronously reads the content and returns the Base64 decoded binary bytes.

(繼承來源 XmlReader)
ReadContentAsBinHex(Byte[], Int32, Int32)

讀取內容,並傳回 BinHex 已解碼的二進位位元組。Reads the content and returns the BinHex decoded binary bytes.

ReadContentAsBinHex(Byte[], Int32, Int32)

讀取內容,並傳回 BinHex 已解碼的二進位位元組。Reads the content and returns the BinHex decoded binary bytes.

(繼承來源 XmlReader)
ReadContentAsBinHexAsync(Byte[], Int32, Int32)

以非同步的方式讀取內容,並傳回 BinHex 的解碼二進位位元組。Asynchronously reads the content and returns the BinHex decoded binary bytes.

(繼承來源 XmlReader)
ReadContentAsBoolean()

Boolean 的形式,讀取目前位置的文字內容。Reads the text content at the current position as a Boolean.

(繼承來源 XmlReader)
ReadContentAsDateTime()

DateTime 物件的形式,讀取目前位置的文字內容。Reads the text content at the current position as a DateTime object.

(繼承來源 XmlReader)
ReadContentAsDateTimeOffset()

DateTimeOffset 物件的形式,讀取目前位置的文字內容。Reads the text content at the current position as a DateTimeOffset object.

(繼承來源 XmlReader)
ReadContentAsDecimal()

Decimal 物件的形式,讀取目前位置的文字內容。Reads the text content at the current position as a Decimal object.

(繼承來源 XmlReader)
ReadContentAsDouble()

以雙精確度浮點數的形式讀取目前位置的文字內容。Reads the text content at the current position as a double-precision floating-point number.

(繼承來源 XmlReader)
ReadContentAsFloat()

以單精確度浮點數的形式讀取目前位置的文字內容。Reads the text content at the current position as a single-precision floating point number.

(繼承來源 XmlReader)
ReadContentAsInt()

以 32 位元帶正負號之整數的形式讀取目前位置的文字內容。Reads the text content at the current position as a 32-bit signed integer.

(繼承來源 XmlReader)
ReadContentAsLong()

以 64 位元帶正負號之整數的形式讀取目前位置的文字內容。Reads the text content at the current position as a 64-bit signed integer.

(繼承來源 XmlReader)
ReadContentAsObject()

Object 的形式,讀取目前位置的文字內容。Reads the text content at the current position as an Object.

(繼承來源 XmlReader)
ReadContentAsObjectAsync()

以非同步方式與 Object 的形式,讀取目前位置的文字內容。Asynchronously reads the text content at the current position as an Object.

(繼承來源 XmlReader)
ReadContentAsString()

String 物件的形式,讀取目前位置的文字內容。Reads the text content at the current position as a String object.

(繼承來源 XmlReader)
ReadContentAsStringAsync()

以非同步方式與 String 物件的形式,讀取目前位置的文字內容。Asynchronously reads the text content at the current position as a String object.

(繼承來源 XmlReader)
ReadElementContentAs(Type, IXmlNamespaceResolver)

以要求之型別的形式讀取項目內容。Reads the element content as the requested type.

(繼承來源 XmlReader)
ReadElementContentAs(Type, IXmlNamespaceResolver, String, String)

檢查指定的區域名稱和命名空間 URI 是否與目前的項目相符,然後以要求之型別的形式讀取項目內容。Checks that the specified local name and namespace URI matches that of the current element, then reads the element content as the requested type.

(繼承來源 XmlReader)
ReadElementContentAsAsync(Type, IXmlNamespaceResolver)

以要求之型別的形式,非同步讀取項目內容。Asynchronously reads the element content as the requested type.

(繼承來源 XmlReader)
ReadElementContentAsBase64(Byte[], Int32, Int32)

讀取項目,並將 Base64 內容解碼。Reads the element and decodes the Base64 content.

ReadElementContentAsBase64(Byte[], Int32, Int32)

讀取項目,並將 Base64 內容解碼。Reads the element and decodes the Base64 content.

(繼承來源 XmlReader)
ReadElementContentAsBase64Async(Byte[], Int32, Int32)

以非同步的方式讀取項目,並將 Base64 內容解碼。Asynchronously reads the element and decodes the Base64 content.

(繼承來源 XmlReader)
ReadElementContentAsBinHex(Byte[], Int32, Int32)

讀取項目,並將 BinHex 內容解碼。Reads the element and decodes the BinHex content.

ReadElementContentAsBinHex(Byte[], Int32, Int32)

讀取項目,並將 BinHex 內容解碼。Reads the element and decodes the BinHex content.

(繼承來源 XmlReader)
ReadElementContentAsBinHexAsync(Byte[], Int32, Int32)

以非同步的方式讀取項目,並將 BinHex 內容解碼。Asynchronously reads the element and decodes the BinHex content.

(繼承來源 XmlReader)
ReadElementContentAsBoolean()

Boolean 物件的形式,讀取目前項目並傳回內容。Reads the current element and returns the contents as a Boolean object.

(繼承來源 XmlReader)
ReadElementContentAsBoolean(String, String)

檢查指定的區域名稱和命名空間 URI 是否與目前的項目相符,然後以 Boolean 物件的形式,讀取目前的項目並傳回內容。Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a Boolean object.

(繼承來源 XmlReader)
ReadElementContentAsDateTime()

DateTime 物件的形式,讀取目前項目並傳回內容。Reads the current element and returns the contents as a DateTime object.

(繼承來源 XmlReader)
ReadElementContentAsDateTime(String, String)

檢查指定的區域名稱和命名空間 URI 是否與目前的項目相符,然後以 DateTime 物件的形式,讀取目前的項目並傳回內容。Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a DateTime object.

(繼承來源 XmlReader)
ReadElementContentAsDecimal()

Decimal 物件的形式,讀取目前項目並傳回內容。Reads the current element and returns the contents as a Decimal object.

(繼承來源 XmlReader)
ReadElementContentAsDecimal(String, String)

檢查指定的區域名稱和命名空間 URI 是否與目前的項目相符,然後以 Decimal 物件的形式,讀取目前的項目並傳回內容。Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a Decimal object.

(繼承來源 XmlReader)
ReadElementContentAsDouble()

以雙精確度浮點數的形式,讀取目前的項目並傳回內容。Reads the current element and returns the contents as a double-precision floating-point number.

(繼承來源 XmlReader)
ReadElementContentAsDouble(String, String)

檢查指定的區域名稱和命名空間 URI 是否與目前的項目相符,然後以雙精確度浮點數的形式,讀取目前的項目並傳回內容。Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a double-precision floating-point number.

(繼承來源 XmlReader)
ReadElementContentAsFloat()

以單精確度浮點數的形式,讀取目前的項目並傳回內容。Reads the current element and returns the contents as single-precision floating-point number.

(繼承來源 XmlReader)
ReadElementContentAsFloat(String, String)

檢查指定的區域名稱和命名空間 URI 是否與目前的項目相符,然後以單精確度浮點數的形式,讀取目前的項目並傳回內容。Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a single-precision floating-point number.

(繼承來源 XmlReader)
ReadElementContentAsInt()

以 32 位元帶正負號之整數的形式,讀取目前的項目並傳回內容。Reads the current element and returns the contents as a 32-bit signed integer.

(繼承來源 XmlReader)
ReadElementContentAsInt(String, String)

檢查指定的區域名稱和命名空間 URI 是否與目前的項目相符,然後以 32 位元帶正負號之整數的形式,讀取目前的項目並傳回內容。Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a 32-bit signed integer.

(繼承來源 XmlReader)
ReadElementContentAsLong()

以 64 位元帶正負號之整數的形式讀取目前的元素並傳回內容。Reads the current element and returns the contents as a 64-bit signed integer.

(繼承來源 XmlReader)
ReadElementContentAsLong(String, String)

檢查指定的區域名稱和命名空間 URI 是否與目前的項目相符,然後以 64 位元帶正負號之整數的形式讀取目前的元素並傳回內容。Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a 64-bit signed integer.

(繼承來源 XmlReader)
ReadElementContentAsObject()

Object 的形式,讀取目前項目並傳回內容。Reads the current element and returns the contents as an Object.

(繼承來源 XmlReader)
ReadElementContentAsObject(String, String)

檢查指定的區域名稱和命名空間 URI 是否與目前的項目相符,然後以 Object 的形式,讀取目前的項目並傳回內容。Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as an Object.

(繼承來源 XmlReader)
ReadElementContentAsObjectAsync()

以非同步方式與 Object 的形式,讀取目前項目並傳回內容。Asynchronously reads the current element and returns the contents as an Object.

(繼承來源 XmlReader)
ReadElementContentAsString()

String 物件的形式,讀取目前項目並傳回內容。Reads the current element and returns the contents as a String object.

(繼承來源 XmlReader)
ReadElementContentAsString(String, String)

檢查指定的區域名稱和命名空間 URI 是否與目前的項目相符,然後以 String 物件的形式,讀取目前的項目並傳回內容。Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a String object.

(繼承來源 XmlReader)
ReadElementContentAsStringAsync()

以非同步方式與 String 物件的形式,讀取目前項目並傳回內容。Asynchronously reads the current element and returns the contents as a String object.

(繼承來源 XmlReader)
ReadElementString()

讀取純文字項目。Reads a text-only element. 不過,我們建議您改用ReadElementContentAsString()方法相反地,因為它會提供較簡單的方式來處理這項作業。However, we recommend that you use the ReadElementContentAsString() method instead, because it provides a more straightforward way to handle this operation.

(繼承來源 XmlReader)
ReadElementString(String)

檢查Name屬性找到的項目之前讀取純文字的項目符合指定的字串。Checks that the Name property of the element found matches the given string before reading a text-only element. 不過,我們建議您改用ReadElementContentAsString()方法相反地,因為它會提供較簡單的方式來處理這項作業。However, we recommend that you use the ReadElementContentAsString() method instead, because it provides a more straightforward way to handle this operation.

(繼承來源 XmlReader)
ReadElementString(String, String)

檢查LocalNameNamespaceURI項目的屬性找到符合的指定的字串之前讀取純文字的項目。Checks that the LocalName and NamespaceURI properties of the element found matches the given strings before reading a text-only element. 不過,我們建議您改用ReadElementContentAsString(String, String)方法相反地,因為它會提供較簡單的方式來處理這項作業。However, we recommend that you use the ReadElementContentAsString(String, String) method instead, because it provides a more straightforward way to handle this operation.

(繼承來源 XmlReader)
ReadEndElement()

檢查目前節點為結尾標記,並使讀取器前進至下一個節點。Checks that the current content node is an end tag and advances the reader to the next node.

(繼承來源 XmlReader)
ReadInnerXml()

在衍生類別中覆寫時,將所有的內容當做字串讀取,包括標記。When overridden in a derived class, reads all the content, including markup, as a string.

(繼承來源 XmlReader)
ReadInnerXmlAsync()

以字串形式非同步讀取所有內容,包括標記。Asynchronously reads all the content, including markup, as a string.

(繼承來源 XmlReader)
ReadOuterXml()

在衍生類別中覆寫時,讀取代表這個節點及其所有子節點的內容,包括標記。When overridden in a derived class, reads the content, including markup, representing this node and all its children.

(繼承來源 XmlReader)
ReadOuterXmlAsync()

非同步讀取表示這個節點及其所有子系的內容,包括標記。Asynchronously reads the content, including markup, representing this node and all its children.

(繼承來源 XmlReader)
ReadStartElement()

檢查以確定目前節點為項目,然後使讀取器前進至下一個節點。Checks that the current node is an element and advances the reader to the next node.

(繼承來源 XmlReader)
ReadStartElement(String)

檢查目前的內容節點是否具有的項目指定Name並使讀取器前進至下一個節點。Checks that the current content node is an element with the given Name and advances the reader to the next node.

(繼承來源 XmlReader)
ReadStartElement(String, String)

檢查目前的內容節點是否具有的項目指定LocalNameNamespaceURI並使讀取器前進至下一個節點。Checks that the current content node is an element with the given LocalName and NamespaceURI and advances the reader to the next node.

(繼承來源 XmlReader)
ReadString()

將項目或文字節點的內容當做字串讀取。Reads the contents of an element or a text node as a string.

ReadString()

在衍生類別中覆寫時,將項目或文字節點的內容當做字串讀取。When overridden in a derived class, reads the contents of an element or text node as a string. 不過,我們建議您改用ReadElementContentAsString方法相反地,因為它會提供較簡單的方式來處理這項作業。However, we recommend that you use the ReadElementContentAsString method instead, because it provides a more straightforward way to handle this operation.

(繼承來源 XmlReader)
ReadSubtree()

傳回新XmlReader可以用來讀取目前的節點及其所有子系的執行個體。Returns a new XmlReader instance that can be used to read the current node, and all its descendants.

(繼承來源 XmlReader)
ReadToDescendant(String)

往前推進XmlReader下一個子系的項目,具有指定限定名稱。Advances the XmlReader to the next descendant element with the specified qualified name.

(繼承來源 XmlReader)
ReadToDescendant(String, String)

往前推進XmlReader下一個子系的項目,使用指定的區域名稱和命名空間 URI。Advances the XmlReader to the next descendant element with the specified local name and namespace URI.

(繼承來源 XmlReader)
ReadToFollowing(String)

在找到具有指定限定名稱的項目之前讀取。Reads until an element with the specified qualified name is found.

(繼承來源 XmlReader)
ReadToFollowing(String, String)

在找到具有指定區域名稱和命名空間 URI 的項目之前讀取。Reads until an element with the specified local name and namespace URI is found.

(繼承來源 XmlReader)
ReadToNextSibling(String)

往前推進XmlReader指定限定名稱的下一個同層級項目。Advances the XmlReader to the next sibling element with the specified qualified name.

(繼承來源 XmlReader)
ReadToNextSibling(String, String)

XmlReader 前移到下一個具有指定區域名稱和命名空間 URI 的同層級項目。Advances the XmlReader to the next sibling element with the specified local name and namespace URI.

(繼承來源 XmlReader)
ReadValueChunk(Char[], Int32, Int32)

讀取 XML 文件中內嵌之大量文字資料流。Reads large streams of text embedded in an XML document.

(繼承來源 XmlReader)
ReadValueChunkAsync(Char[], Int32, Int32)

以非同步的方式讀取 XML 文件中內嵌之大量文字資料流。Asynchronously reads large streams of text embedded in an XML document.

(繼承來源 XmlReader)
ResetState()

將讀取器的狀態重設為 ReadState.Initial。Resets the state of the reader to ReadState.Initial.

ResolveEntity()

解析 EntityReference 節點的實體參考。Resolves the entity reference for EntityReference nodes.

Skip()

略過目前節點的子節點。Skips the children of the current node.

Skip()

略過目前節點的子節點。Skips the children of the current node.

(繼承來源 XmlReader)
SkipAsync()

以非同步的方式略過目前節點的子節點。Asynchronously skips the children of the current node.

(繼承來源 XmlReader)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

明確介面實作

IDisposable.Dispose()

如需這個成員的說明,請參閱 Dispose()For a description of this member, see Dispose().

(繼承來源 XmlReader)
IXmlLineInfo.HasLineInfo()

如需這個成員的說明,請參閱 HasLineInfo()For a description of this member, see HasLineInfo().

IXmlNamespaceResolver.GetNamespacesInScope(XmlNamespaceScope)

如需這個成員的說明,請參閱 GetNamespacesInScope(XmlNamespaceScope)For a description of this member, see GetNamespacesInScope(XmlNamespaceScope).

IXmlNamespaceResolver.LookupNamespace(String)

如需這個成員的說明,請參閱 LookupNamespace(String)For a description of this member, see LookupNamespace(String).

IXmlNamespaceResolver.LookupPrefix(String)

如需這個成員的說明,請參閱 LookupPrefix(String)For a description of this member, see LookupPrefix(String).

適用於

另請參閱