This documentation is archived and is not being maintained.

XPathNavigator.LookupPrefix Method

Gets the prefix declared for the specified namespace URI.

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

public virtual string LookupPrefix(
	string namespaceURI
)

Parameters

namespaceURI
Type: System.String

The namespace URI to resolve for the prefix.

Return Value

Type: System.String
A String that contains the namespace prefix assigned to the namespace URI specified; otherwise, String.Empty if no prefix is assigned to the namespace URI specified. The String returned is atomized.

Implements

IXmlNamespaceResolver.LookupPrefix(String)

The LookupPrefix method returns the first prefix that matches the namespace URI specified. Multiple prefixes referring to the same namespace URI are not ordered in any particular way, so a particular prefix may not be returned each time when more than one is assigned.

NoteNote:

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

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Show: