System.Xml.XmlTextReader.GetNamespacesInScope Method

Gets a collection that contains all namespaces currently in-scope.

Syntax

public IDictionary<string, string> GetNamespacesInScope (XmlNamespaceScope scope)

Parameters

scope
An System.Xml.XmlNamespaceScope value that specifies the type of namespace nodes to return.

Returns

An IDictionary object that contains all the current in-scope namespaces. If the reader is not positioned on an element, an empty dictionary (no namespaces) is returned.

Remarks

Note:

In the dnprdnext release, the recommended practice is to create System.Xml.XmlReader instances using the erload:System.Xml.XmlReader.Create method. This allows you to take full advantage of the new features introduced in this release. For more information, see Creating XML Readers.

The dictionary consists of a collection of namespace names keyed by prefix. It can be used to enumerate the in-scope namespaces. The dictionary is a disconnected copy of the namespace list of the reader. It remains unchanged as the reader position, current in-scope namespace list, changes.

The following table describes how the System.Xml.XmlNamespaceScope enumeration value affects the whether or not the default and built-in namespaces are returned by XmlTextReader.GetNamespacesInScope(XmlNamespaceScope).

All

yes

no

no

ExcludeXml

no

no

no

Local

no

no

yes

Requirements

Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0