Windows apps
Collapse the table of content
Expand the table of content
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.

XmlArrayItemAttribute::Form Property

 

Gets or sets a value that indicates whether the name of the generated XML element is qualified.

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

public:
property XmlSchemaForm Form {
	XmlSchemaForm get();
	void set(XmlSchemaForm value);
}

Property Value

Type: System.Xml.Schema::XmlSchemaForm

One of the XmlSchemaForm values. The default is XmlSchemaForm.None.

Exception Condition
Exception

The Form property is set to XmlSchemaForm.Unqualified and a Namespace value is specified.

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 ref class Vehicle
{
public:
   String^ id;
};

public ref class Car: public Vehicle
{
public:
   String^ Maker;
};

public ref class Transportation
{
public:

   // Specifies the Form property value.

   [XmlArray("Vehicles")]
   [XmlArrayItem(Vehicle::typeid,
   Form=XmlSchemaForm::Unqualified),
   XmlArrayItem(Car::typeid,
   Form=XmlSchemaForm::Qualified)]
   array<Vehicle^>^MyVehicles;
};

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show:
© 2017 Microsoft