Game Development Reference
In-Depth Information
public string Character;
/// <remarks/>
public string Description;
/// <remarks/>
public System.Single HitPoints;
/// <remarks/>
public System.Single MoveSpeed;
/// <remarks/>
public System.Single AttackPower;
/// <remarks/>
public CharactersCharacterDataClass Class;
/// <remarks/>
public string Thumbnail;
}
/// <remarks/>
public enum CharactersCharacterDataClass {
/// <remarks/>
Standard,
/// <remarks/>
Armored,
}
}
Listing 12.13. Auto-generated class from XSD (xformedtyped.cs).
You might be asking why we'd spend time modifying an XSD when we could just
add attributes to a class we've defined from scratch. Writing the class from scratch
and adding attributes to map field names certainly provides more flexibility to us,
not to mention better-named enumerations and classes. However, generating the
class specification from an XSD takes care of one important use case: portability.
In the next section we'll make use of this XSD to automatically handle parsing our
XML data in another language: C++.
12.4.3 XML Data Binding in Other Languages
Most popular programming languages have XML data binding libraries available.
However, it should be mentioned that not all data binding approaches are equal.
Some XML data binding formats don't conform to XML schema [XML 10b], for-
malized by the W3C in 2001, which is the one that .NET uses. For example, the
Boost C++ Library has its own XML serialization format. Luckily, there is a good
resource for finding libraries for various programming languages. Ronald Bourret
has been keeping a list current since 2001 on his personal domain [Bourret 10]. A
few are worth mentioning here to get you started:
Search WWH ::




Custom Search