XmlArrayItemAttribute.Form Property
Assembly: System.Xml (in system.xml.dll)
/** @property */ public XmlSchemaForm get_Form () /** @property */ public void set_Form (XmlSchemaForm value)
public function get Form () : XmlSchemaForm public function set Form (value : XmlSchemaForm)
Not applicable.
Property Value
One of the XmlSchemaForm values. The default is XmlSchemaForm.None.The Form property determines whether an XML element name is qualified, based on the World Wide Web Consortium (www.w3.org) 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 value, XmlSchemaForm.None, instructs the XmlSerializer to check the schema for the XML document to determine whether the namespace is qualified. For elements, the XmlSerializer checks the value of the schema-element attribute elementFormDefault. For attributes, it checks the value of the schema-element attribute attributeFormDefault. For example, the following XML Schema indicates that the Name element is qualified, while the Number element is unqualified.
<schema elementFormDefault="qualified"
attributeFormDefault="unqualified">
<element name="Name"/>
<attribute name="Number"/>
</schema>
The following example sets the Form property for the Vehicle class to XmlSchemaForm.Unqualified, and the Form property for the Car class to XmlSchemaForm.Qualified.
public class Transportation { [XmlArray("Vehicles")] // Specifies the Form property value. [XmlArrayItem(typeof(Vehicle), Form = XmlSchemaForm.Unqualified), XmlArrayItem(typeof(Car), Form = XmlSchemaForm.Qualified)] public Vehicle[] MyVehicles; } public class Vehicle { public string id; } public class Car:Vehicle { public string Maker; }
public class Transportation
{
/** @attribute XmlArray("Vehicles")
*/
// Specifies the Form property value.
/** @attribute XmlArrayItem(Vehicle.class,
Form = XmlSchemaForm.Unqualified)
@attribute XmlArrayItem(Car.class,
Form = XmlSchemaForm.Qualified)
*/
public Vehicle myVehicles[];
} //Transportation
public class Vehicle
{
public String id;
} //Vehicle
public class Car extends Vehicle
{
public String maker;
} //Car
Windows 98, Windows Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.