Επεξεργασία

Κοινή χρήση μέσω


XmlNamespaceManager.HasNamespace(String) Method

Definition

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

public:
 virtual bool HasNamespace(System::String ^ prefix);
public virtual bool HasNamespace (string prefix);
abstract member HasNamespace : string -> bool
override this.HasNamespace : string -> bool
Public Overridable Function HasNamespace (prefix As String) As Boolean

Parameters

prefix
String

The prefix of the namespace you want to find.

Returns

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

Examples

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

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

Remarks

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.

Note

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

Applies to

See also