Default UML to XSD Mappings

When you are defining simple schemas using abstract Class models, the Enterprise Architect Schema Generator translates the UML information to XSD using a default mapping of UML to XSD constructs. These defaults are also used by the Schema Generator to generate unstereotyped elements in an abstract model.

When you model XML Schema using the XML Schema pages of the Diagram Toolbox, the stereotypes and Tagged Values of the Toolbox elements override the default mappings.


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 also 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 by 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 attributes reflect the cardinality of the Association.


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 XSDall Model Group within the extension element.



A simpleType element is declared for the Enumeration with the name attribute set to the Enumeration name. A Restriction element is generated with base set to string. Each of the Enumeration 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, the minOccurs and maxOccurs attributes default to 1
·If the direction of the Association is unspecified, the owner is assumed to be the source

Learning Center topics

·(Alt+F1) | Enterprise Architect | SOA and XML Engineering | XSD | Order Elements
·(Alt+F1) | Enterprise Architect | SOA and XML Engineering | XSD | Refer External Schema