Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
 LookupPrefix Method
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
XmlNamespaceManager..::.LookupPrefix Method

Finds the prefix declared for the given namespace URI.

Namespace:  System.Xml
Assembly:  System.Xml (in System.Xml.dll)
Visual Basic (Declaration)
Public Overridable Function LookupPrefix ( _
    uri As String _
) As String
Visual Basic (Usage)
Dim instance As XmlNamespaceManager
Dim uri As String
Dim returnValue As String

returnValue = instance.LookupPrefix(uri)
C#
public virtual string LookupPrefix(
    string uri
)
Visual C++
public:
virtual String^ LookupPrefix(
    String^ uri
)
JScript
public function LookupPrefix(
    uri : String
) : String

Parameters

uri
Type: System..::.String
The namespace to resolve for the prefix.

Return Value

Type: System..::.String
The matching prefix. If there is no mapped prefix, the method returns String.Empty. If a null value is supplied, then nullNothingnullptra null reference (Nothing in Visual Basic) is returned.

Implements

IXmlNamespaceResolver..::.LookupPrefix(String)

This method finds the mapped prefix by walking the stack (that is, it looks globally). The supplied string must be atomized for the lookup to succeed. In other words, the supplied string object must exist in the XmlNamespaceManager's NameTable.

The returned string is also atomized. For more information on atomized strings, see XmlNameTable.

The following example removes a namespace from the namespace manager.

Visual Basic
Dim prefix As String = nsmgr.LookupPrefix("www.wideworldimporters.com/europe")
nsmgr.RemoveNamespace(prefix, "www.wideworldimporters.com/europe")
C#
String prefix = nsmgr.LookupPrefix("www.wideworldimporters.com/europe");
nsmgr.RemoveNamespace(prefix, "www.wideworldimporters.com/europe");
Visual C++
String^ prefix = nsmgr->LookupPrefix( "www.wideworldimporters.com/europe" );
nsmgr->RemoveNamespace( prefix, "www.wideworldimporters.com/europe" );
CPP_OLD
String* prefix = nsmgr->LookupPrefix(S"www.wideworldimporters.com/europe");
nsmgr->RemoveNamespace(prefix, S"www.wideworldimporters.com/europe");

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, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune

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, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0

XNA Framework

Supported in: 3.0, 2.0, 1.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker