System.Xml.XmlNodeReader.LookupNamespace Method

Resolves a namespace prefix in the current element's scope.

Syntax

public override string LookupNamespace (string prefix)

Parameters

prefix
The prefix whose namespace URI you want to resolve. To match the default namespace, pass an empty string. This string does not have to be atomized.

Returns

The namespace URI to which the prefix maps or null if no matching prefix is found.

Remarks

Note:

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

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

Example

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

Requirements

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