Windows Dev Center

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.

XmlElementAttribute.Form Property

Gets or sets a value that indicates whether the element is qualified.

Namespace: System.Xml.Serialization
Assembly: System.Xml (in system.xml.dll)

public XmlSchemaForm Form { get; set; }
/** @property */
public XmlSchemaForm get_Form ()

/** @property */
public void set_Form (XmlSchemaForm value)

public function get Form () : XmlSchemaForm

public function set Form (value : XmlSchemaForm)

Property Value

One of the XmlSchemaForm values. The default is Qualified.

The Form property determines whether an XML element is qualified or unqualified. The Form property conforms to the World Wide Web Consortium (www.w3.org) 1999 specification, "Namespaces in XML".

If the Namespace property is set to any value, attempting to set the Form property to XmlSchemaForm.Unqualified throws an exception. The default setting, XmlSchemaForm.None, instructs the XmlSerializer to check the schema for the XML document to determine whether the namespace is qualified. If the schema does not specify a value for an individual element or attribute, the XmlSerializer uses the elementFormDefault and attributeFormDefault values to determine whether an element or attribute is qualified. The following XML code shows a schema:

 <schema elementFormDefault="qualified" 
 attributeFormDefault="unqualified"... >
  <element name="Name"/>
  <attribute name="Number"/>
 </schema>

When the XmlSerializer reads the schema, the Form value for both the Name and Number is XmlSchemaForm.None, but the Name element is qualified, while the Number element is unqualified.

The following example sets the Form property to XmlSchemaForm.Unqualified.

public class MyClass
{
   [XmlElement(Form = XmlSchemaForm.Unqualified)]
   public string ClassName;
}


public class MyClass
{
    /** @attribute XmlElement(Form = XmlSchemaForm.Unqualified)
     */
    public String className;
} //MyClass

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0

Community Additions

Show:
© 2015 Microsoft