XmlTextReader.GetNamespacesInScope(XmlNamespaceScope) 方法

定義

取得集合,包含目前範圍內的所有命名空間。

public:
 System::Collections::Generic::IDictionary<System::String ^, System::String ^> ^ GetNamespacesInScope(System::Xml::XmlNamespaceScope scope);
public System.Collections.Generic.IDictionary<string,string> GetNamespacesInScope (System.Xml.XmlNamespaceScope scope);
member this.GetNamespacesInScope : System.Xml.XmlNamespaceScope -> System.Collections.Generic.IDictionary<string, string>
Public Function GetNamespacesInScope (scope As XmlNamespaceScope) As IDictionary(Of String, String)

參數

scope
XmlNamespaceScope

XmlNamespaceScope 值,指定要傳回之命名空間節點的類型。

傳回

IDictionary 物件,包含目前範圍內的所有命名空間。 如果讀取器不位於項目上,則會傳回空的字典 (沒有命名空間)。

備註

注意

從 .NET Framework 2.0 開始,建議您使用 XmlReader.Create 方法來建立 XmlReader 實例,以利用新功能。

字典是由以前置詞索引鍵的命名空間名稱集合所組成。 它可用來列舉範圍中的命名空間。 字典是讀取器命名空間清單的中斷連線複本。 當讀取器位置、目前的範圍內命名空間清單變更時,它會保持不變。

下表描述列舉值如何影響 XmlNamespaceScope 所傳回 GetNamespacesInScope 的預設和內建命名空間。

XmlNamespaceScope 值 xmlns:xml xmlns:xmlns xmlns=「」
All
ExcludeXml
Local

適用於

另請參閱