An object instance is serialized to a serial format, such as an eXtensible Markup
Language (XML) document, based on a mapping between an arbitrary annotated source
code file and a schema. The arbitrary annotated source code contains at least one
programming type that describes a shape of an object instance and the schema describes
a format of a document having a serial format. The mapping defines a correspondence
between the shape of the object instance and the format of the document having
the serial format. Subsequently, an object instance is converted to the serial
format by converting public properties, public fields and method parameters of
the object instance to a document having the serial format based on the mapping.
Once the mapping is defined, an XML document can also be converted to an object
instance based on the mapping.