System.Xml.XmlQualifiedName Class

Assembly: System.Xml.dll
Namespace: System.Xml
Summary
Represents an XML qualified name.
C# Syntax:
public class XmlQualifiedName
Remarks
An XML qualified name is a namespace qualified local name, in the format of namespace:localname.

Because prefixes are only required when XML is persisted or read, they are irrelevant for XmlQualifiedName objects. This class assumes that prefixes are irrelevant. It is the responsibility of the user to ensure the local name does not contain a ":".

Example
For an example using the XmlQualifiedName class, see XmlSchemaAll.
See also:
System.Xml Namespace

System.Xml.XmlQualifiedName Member List:

Public Constructors
ctor #1 Overloaded:
.ctor()

Default constructor. This constructor is called by derived class constructors to initialize state in this type.
Initializes a new instance of the XmlQualifedName class.
ctor #2 Overloaded:
.ctor(string name)

Initializes a new instance of the XmlQualifedName class with the specified name.
ctor #3 Overloaded:
.ctor(string name, string ns)

Initializes a new instance of the XmlQualifedName class with the specified name and namespace.
Public Fields
Empty Provides an empty XmlQualifiedName.
Public Properties
IsEmpty Read-only

Name Read-only

Gets a string representation of the qualified name of the XmlQualifiedName.
Namespace Read-only

Gets a string representation of the namespace of the XmlQualifiedName.
Public Methods
Equals Overridden:
Checks if the specified XmlQualifiedName is the same instance object as this object.
GetHashCode Overridden:
Returns the hash code for the XmlQualifiedName.
GetType
(inherited from System.Object)
See base class member description: System.Object.GetType

Derived from System.Object, the primary base class for all objects.
ToString Overloaded:
ToString()

Overridden:
Returns the string value of the XmlQualifiedName.
ToString Overloaded:
ToString(string name, string ns)

Returns the string value of the XmlQualifiedName.
Public Operators and Type Conversions
op_Equality Compares two XmlQualifiedName objects.
op_Inequality Compares two XmlQualifiedName objects.
Protected Methods
Finalize
(inherited from System.Object)
See base class member description: System.Object.Finalize

Derived from System.Object, the primary base class for all objects.
MemberwiseClone
(inherited from System.Object)
See base class member description: System.Object.MemberwiseClone

Derived from System.Object, the primary base class for all objects.

Hierarchy:


System.Xml.XmlQualifiedName Member Details

Overloaded ctor #1
Summary
Initializes a new instance of the XmlQualifedName class.

Default constructor. This constructor is called by derived class constructors to initialize state in this type.
C# Syntax:
public XmlQualifiedName();
Remarks
The object created has no name or namespace defined.

Return to top


Overloaded ctor #2
Summary
Initializes a new instance of the XmlQualifedName class with the specified name.
C# Syntax:
public XmlQualifiedName(
   string name
);
Parameters:

name

The local name to use as the name of the XmlQualifiedName object.

Remarks
The object created does not have a namespace defined.

Return to top


Overloaded ctor #3
Summary
Initializes a new instance of the XmlQualifedName class with the specified name and namespace.
C# Syntax:
public XmlQualifiedName(
   string name,
   string ns
);
Parameters:

name

The local name to use as the name of the XmlQualifiedName object.

ns

The namespace for the XmlQualifiedName object.

Return to top


Field: Empty
Summary
Provides an empty XmlQualifiedName.
C# Syntax:
public static readonly XmlQualifiedName Empty;
Remarks
This field allows you to do the following:
              XmlQualifiedName Qname = new XmlQualifiedName ("item","http://www.contoso.com/");
              Qname.IsEmpty; //Returns false.
              Qname.Empty; //Sets the namespace and local name to String.Empty.
              Qname.IsEmpty; //Returns true.
               
            

Return to top


Property: IsEmpty (read-only)
Summary
Gets a value indicating whether the XmlQualifedName is empty.
C# Syntax:
public bool IsEmpty {get;}

Return to top


Property: Name (read-only)
Summary
Gets a string representation of the qualified name of the XmlQualifiedName.
C# Syntax:
public string Name {get;}

Return to top


Property: Namespace (read-only)
Summary
Gets a string representation of the namespace of the XmlQualifiedName.
C# Syntax:
public string Namespace {get;}

Return to top


Overridden Method: Equals(
   object other
)
Summary
Checks if the specified XmlQualifiedName is the same instance object as this object.
C# Syntax:
public override bool Equals(
   object other
);
Parameters:

other

The XmlQualifiedName to compare.

Return Value:
true if the two are the same instance object; otherwise false.

Return to top


Method: Finalize()
Inherited
See base class member description: System.Object.Finalize
C# Syntax:
~XmlQualifiedName();

For more information on members inherited from System.Object click on the link above.

Return to top


Overridden Method: GetHashCode()
Summary
Returns the hash code for the XmlQualifiedName.
C# Syntax:
public override int GetHashCode();
Return Value:
A hash code for this object.

Return to top


Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: op_Equality(
   XmlQualifiedName a,
   XmlQualifiedName b
)
Summary
Compares two XmlQualifiedName objects.
C# Syntax:
public static bool operator ==(
   XmlQualifiedName a,
   XmlQualifiedName b
);
Parameters:

a

An XmlQualifiedName to compare.

b

An XmlQualifiedName to compare.

Return Value:
true if the two objects have the same name and namespace values; otherwise false.

Return to top


Method: op_Inequality(
   XmlQualifiedName a,
   XmlQualifiedName b
)
Summary
Compares two XmlQualifiedName objects.
C# Syntax:
public static bool operator !=(
   XmlQualifiedName a,
   XmlQualifiedName b
);
Parameters:

a

An XmlQualifiedName to compare.

b

An XmlQualifiedName to compare.

Return Value:
true if the name and namespace values for the two objects differ; otherwise false.

Return to top


Overloaded Method: ToString()
Summary
Returns the string value of the XmlQualifiedName.
C# Syntax:
public override string ToString();
Return Value:
The string value of the XmlQualifiedName in the format of namespace:localname. If the object does not have a namespace defined, this method returns just the local name.

Return to top


Overloaded Method: ToString(
   string name,
   string ns
)
Summary
Returns the string value of the XmlQualifiedName.
C# Syntax:
public static string ToString(
   string name,
   string ns
);
Parameters:

name

The name of the object.

ns

The namespace of the object.

Return Value:
The string value of the XmlQualifiedName in the format of namespace:localname. If the object does not have a namespace defined, this method returns just the local name.

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.