The operation takes any object (anObject
) and tries to map it to an XML fragment. The fragment structure is given by the class definition of anObject
. If this is not possible an error is raised (e.g. XML parser errors, invalid mappings, etc.)
By default the following mapping rules apply:
- Class attributes are mapped to XML attributes.
- Association ends are mapped to XML elements.
These default rules can be overridden by using the stereotypes XMLElement, XMLAttribute, and XMLCharacters on class properties.
More about these mapping rules, stereotypes and tagged values (e.g. for number and date & time formatting) can be found on Controlling the XML Serialization With Stereotypes.