This documentation is archived and is not being maintained.

XmlReader.LookupNamespace Method

When overridden in a derived class, resolves a namespace prefix in the current element's scope.

[Visual Basic]
Public MustOverride Function LookupNamespace( _
   ByVal prefix As String _
) As String
public abstract string LookupNamespace(
 string prefix
public: virtual String* LookupNamespace(
 String* prefix
) = 0;
public abstract function LookupNamespace(
   prefix : String
) : String;


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.

Return Value

The namespace URI to which the prefix maps or a null reference (Nothing in Visual Basic) if no matching prefix is found.


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

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


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

XmlReader Class | XmlReader Members | System.Xml Namespace