Default UML to XSD mappings

Return to Introduction  Previous page  Next page

The following table describes the default mapping of UML to XSD constructs. This set of mappings is useful when defining simple schemas from abstract class models. The defaults are also assumed by the schema generator when generating unstereotyped elements in an abstract model.  The XML Schema pages of the Enterprise Architect UML Toolbox (and UML Profile for XSD) override these default mappings through the use of stereotypes and Tagged Values.

UML Construct

Default XSD Production Rules


A schema element is generated for the target package. If the target package includes classes from another package, which has the Tagged Values targetNamespace and targetNamespacePrefix set, these are included as attributes of the schema element.

In addition, an import or include element is created for each referenced package. (An include element is used if the external package shares the same targetNamespace Tagged Value as the target package. An import element is used where the targetNamespaces differ).


A root-level element declaration and complexType definition are generated. The element name and type are the same as the class name. An XSD sequence model group is generated to contain UML attributes generated as elements.


An element is declared for each class attribute. The element name is set to that of the UML attribute name. This is prefixed with the class name to make the element unique. The minOccurs and maxOccurs attributes are set to reflect the attribute cardinality.

Note: If left unspecified, minOccurs and maxOccurs default to 1.

If the attribute refers to another class, the element declaration is followed a complexType definition, which contains a reference to the appropriate complexType.


An element is declared for each association owned by a class. The element name is set to that of the association role. The minOccurs and maxOccurs reflect the cardinality of the association.

Note: If the direction of the association is unspecified, the owner is assumed to be the source.

Generalization (Inheritance)

For single inheritances, an extension element is generated with the base attribute set to the base class name. The UML attributes of the child class are then appended to an all model group within the extension element.

<<enumeration>> (stereotype)

A simpleType element is declared for the enumeration class with the name attribute set to the class name. A restriction element is generated with base set to string. Each of the class attributes is appended to the restriction element as XSD enumeration elements with value set to the UML attribute name. Any type specification for the UML attributes is ignored by the schema generator.