Editar

Compartir a través de


XmlReader.LookupNamespace(String) Method

Definition

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

public:
 abstract System::String ^ LookupNamespace(System::String ^ prefix);
public abstract string LookupNamespace (string prefix);
public abstract string? LookupNamespace (string prefix);
abstract member LookupNamespace : string -> string
Public MustOverride Function LookupNamespace (prefix As String) As String

Parameters

prefix
String

The prefix whose namespace URI you want to resolve. To match the default namespace, pass an empty string.

Returns

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

Exceptions

An XmlReader method was called before a previous asynchronous operation finished. In this case, InvalidOperationException is thrown with the message "An asynchronous operation is already in progress."

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>

Applies to