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 indicating whether the element is qualified.

[Visual Basic]
Public Property Form As XmlSchemaForm
[C#]
public XmlSchemaForm Form {get; set;}
[C++]
public: __property XmlSchemaForm get_Form();
public: __property void set_Form(XmlSchemaForm);
[JScript]
public function get Form() : XmlSchemaForm;
public function set Form(XmlSchemaForm);

Property Value

One of the XmlSchemaForm values. The default is Qualified.

Remarks

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 XML code below 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 will be XmlSchemaForm.None, but the Name element will be qualified, while the Number element will be unqualified.

Example

[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


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


[C++] 
public __gc class MyClass
{
public:
   [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.

Requirements

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

Show:
© 2014 Microsoft