Game Development Reference
In-Depth Information
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Thumbnail" type="xs:string"
minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
Listing 12.12.
Modified XSD with correct types (xformedtyped.xsd).
You'll notice that that the
minOccurs
attribute is set to 1 for the
xs:float
fields. It's necessary to set the
minOccurs
attribute so that additional fields aren't
generated in the class definition for keeping track of whether the field was specified
intheXMLdocument.Also,thepossibleenumerationvaluesforthe
Class
element
have to be specified here in order to convert the XML data to an actual enumeration
value. With our XSD complete, we can now autogenerate the class using
xsd.exe
xformedtyped.xsd /c
, shown in Lisitng 12.13.
// ----------------------------------------------------------
//
<autogenerated>
//
This code was generated by a tool.
//
Mono Runtime Version: 1.1.4322.2032
//
// Changes to this file may cause incorrect behavior and
// will be lost if the code is regenerated.
// </autogenerated>
// ----------------------------------------------------------
//
//This source code was auto-generated by MonoXSD
//
namespace Schemas {
/// <remarks/>
[System.Xml.Serialization.XmlRootAttribute(Namespace="",
IsNullable=false)]
public class Characters {
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute
("CharacterData")]
public CharactersCharacterData[] CharacterData;
}
/// <remarks/>
public class CharactersCharacterData {
/// <remarks/>