Windows apps
Collapse the table of content
Expand the table of content
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 indicating whether the element is qualified.

[Visual Basic]
Public Property Form As XmlSchemaForm
public XmlSchemaForm Form {get; set;}
public: __property XmlSchemaForm get_Form();
public: __property void set_Form(XmlSchemaForm);
public function get Form() : XmlSchemaForm;
public function set Form(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 ( 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 XML code below shows a schema:

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

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


[Visual Basic, C#, C++] The following example sets the Form property to XmlSchemaForm.Unqualified.

[Visual Basic] 
Public Class MyClass1
    <XmlElement(Form := XmlSchemaForm.Unqualified)> _
    Public ClassName As String
End Class

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

public __gc class MyClass
   [XmlElement(Form = XmlSchemaForm::Unqualified)]
   String* ClassName;

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

XmlElementAttribute Class | XmlElementAttribute Members | System.Xml.Serialization Namespace

© 2017 Microsoft