
12. Pragmatic XML Use in Tools 179
Now that we have a simpler XML document, let’s mark up our original
CharacterData class from Listing 12.3 using the XML serializer attributes. The
full list of attributes can be found in a document entitled “Controlling XML Seri-
alization Using Attributes” on Microsoft’s MSDN site. For our purposes, we only
need two:
1. [XmlElement]: controls the mapping between a field and the element name
in the document;
2. [XmlRoot]: used to control mapping between a class and the root element
name of the document.
Listing 12.8 shows our CharacterData class from Listing 12.3 with attributes
added.
public enum CharacterClass
{
Standard ...