Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

XmlNamespaceManager::HasNamespace Method (String^)

 

Gets a value indicating whether the supplied prefix has a namespace defined for the current pushed scope.

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

public:
virtual bool HasNamespace(
	String^ prefix
)

Parameters

prefix
Type: System::String^

The prefix of the namespace you want to find.

Return Value

Type: System::Boolean

true if there is a namespace defined; otherwise, false.

To determine whether there is a default empty namespace defined, set prefix to String.Empty. A return value of true indicates that there is a default namespace defined in the current scope; false indicates that no default namespace is defined.

System_CAPS_noteNote

xmlns:x= "" is illegal according to the W3C Namespaces recommendation.

The following example displays the default namespace, if one exists.

if ( nsmgr->HasNamespace( String::Empty ) )
{
   Console::WriteLine( nsmgr->DefaultNamespace );
}

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show:
© 2017 Microsoft