Default UML to XSD Mappings

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 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.

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.

Generalization (Inheritance)

For single inheritances, an extension element is generated with the base attribute set to the base Classname. 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 Classname. 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.


  • If left unspecified, minOccurs and maxOccurs default to 1
  • If the direction of the association is unspecified, the owner is assumed to be the source