Edit

Share via


XPathNavigator.LookupNamespace(String) Method

Definition

Gets the namespace URI for the specified prefix.

public:
 virtual System::String ^ LookupNamespace(System::String ^ prefix);
public virtual string? LookupNamespace (string prefix);
public virtual string LookupNamespace (string prefix);
abstract member LookupNamespace : string -> string
override this.LookupNamespace : string -> string
Public Overridable 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 Empty.

Returns

A String that contains the namespace URI assigned to the namespace prefix specified; null if no namespace URI is assigned to the prefix specified. The String returned is atomized.

Implements

Examples

For an example of the LookupNamespace method, see the InsertElementAfter or InsertElementBefore methods.

Remarks

If String.Empty is specified as the prefix parameter, the currently assigned default namespace URI is returned. If no default namespace URI is explicitly assigned, and String.Empty is specified as the prefix parameter, the blank prefix is associated with elements that are not in any namespace, and String.Empty is returned.

Note

The prefix to namespace URI mappings can change from node to node in an XML document. As a result, the value of the LookupNamespace method may not be consistent from one node to the next.

Applies to