Sdílet prostřednictvím


XmlReader.LookupNamespace Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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 MustOverride Function LookupNamespace ( _
    prefix As String _
) As String
public abstract string LookupNamespace(
    string prefix
)

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 nulla 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>

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.