Share via


LookupNamespace Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

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

Namespace:  System.Xml
Assembly:  System.Xml (in System.Xml.dll)

Syntax

'Declaration
Public Overridable Function LookupNamespace ( _
    prefix As String _
) As String
public virtual string LookupNamespace(
    string prefix
)
public:
virtual String^ LookupNamespace(
    String^ prefix
)
abstract LookupNamespace : 
        prefix:string -> string 
override LookupNamespace : 
        prefix:string -> string 
public function LookupNamespace(
    prefix : String
) : String

Parameters

  • prefix
    Type: System. . :: . .String
    The prefix whose namespace URI you want to resolve. To match the default namespace, pass an empty string.

Return Value

Type: System. . :: . .String
The namespace URI to which the prefix maps or nullNothingnullptrunita null reference (Nothing in Visual Basic) if no matching prefix is found.

Remarks

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.

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

.NET Framework Security

See Also

Reference

XmlReader Class

System.Xml Namespace