Mono Class Library: System.Xml.XmlTextReader Overview | Members

System.Xml.XmlTextReader.LookupNamespace Method

Resolves a namespace prefix in the scope of the current element.

public override string LookupNamespace (string prefix)

Parameters

prefix
A string specifying the prefix whose namespace URI is to be resolved. To return the default namespace, specify string.Empty.

Returns

A string containing the namespace URI to which the prefix maps. If XmlTextReader.Namespaces is false, prefix is not in XmlTextReader.NameTable, or no matching namespace is found, null is returned.

Exceptions

TypeReason
ArgumentNullExceptionThe XmlTextReader.Namespaces property of the current instance is true and prefix is null.

Remarks

Note:

In the following XML, if the reader is positioned on the href attribute, the prefix "a" is resolved by calling XmlTextReader.LookupNamespace(string)("a"). The returned string is "urn:456".

<root xmlns:a="urn:456">
<item>
<ref href="a:b"/>
</item>
</root>

This method overrides XmlReader.LookupNamespace(string).

Requirements

Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0