UML Profile for XSD

The UML Profile for XSD specifies a set of stereotypes, Tagged Values and constraints that can be applied to the UML model in order to change particular aspects of the resulting schema. For example, you might have to convert certain UML Class attributes to XSD attributes, or use a model group other than the default Sequence.

Enterprise Architect provides native support for the UML Profile for XSD via the XML schema pages of the Toolbox. Alternatively, you can use the profile via Enterprise Architect's generic profile mechanism by downloading the UML Profile for XSD. See the Using Profiles topic for details on importing UML profiles into Enterprise Architect. The XSD profile used by Enterprise Architect is an adaptation of the profile defined in Modeling XML Applications with UML (David Carlson).

The XSD stereotypes provide an explicit mapping from XSD to UML constructs. The Tagged Values further define aspects of the mapping, such as whether the elements should be qualified. Full information on the Tagged Values can be obtained from the W3C XML Schema recommendation. The constraints define any conditions that must be satisfied for the stereotype to apply.

The following stereotypes are provided:

The following tables list the features of the UML Profile for XSD.

Notes:

  • Tagged Value names are shown in bold followed by the allowed values.
  • If a default value is used by Enterprise Architect's schema generator, it is underlined.

«XSDschema»

UML Construct

 

Package

Description

 

All Classes in a package are defined within one schema. This stereotype can be used to specify schema-wide settings.

Tagged Values

anonymousRole:
(true | false)

Specifies if the role name is included in the element declaration for the UML attribute.

 

anonymousType:
(true | false)

Specifies whether the Class type is anonymous for attributes.

 

attributeFormDefault:
(qualified | unqualified)

Determines whether attribute instances must be qualified.

 

defaultNamespace:

The default namespace used in this schema. This value is used to specify the default namespace attribute (xmlns=), in the schema element.

 

elementDerivation:
(true | false)

Determines whether inheritances are generated using XSD extension or copy-down inheritance.

 

elementFormDefault:
(qualified | unqualified)

Determines whether element instances must be qualified.

 

memberNames:
(qualified | unqualified)

Determines whether elements generated from Class attributes have their name qualified by the corresponding Class name.

 

modelGroup:
(all | sequence | choice)

Specifies the default XSD model group used to generate complexType definitions.

 

schemaLocation:

The URI that identifies the location of the schema. This value is used in the import and include elements.

 

targetNamespace:

The URI that uniquely identifies this schema's namespace.

 

targetNamespacePrefix:

The prefix that abbreviates the targetNamespace.

 

version:

The version of this schema.

Constraints

 

None.

«XSDcomplexType»

UML Construct

 

Class

Description

 

complexType definitions are created for generic UML Classes. This stereotypes helps tailor the generation of a complexType definition.

Tagged Values

memberNames:
(qualified | unqualified)

Determines whether elements generated from the UML Class attributes and associations have their name qualified by the corresponding Class name for this complexType definition.

 

mixed:
(true | false)

Determines whether this element can contain mixed element and character content. See the W3CXML Schema recommendation.

 

modelGroup:
(all | sequence | choice)

Overrides the default XSD model for generating this complexType definition.

Constraints

 

None.

«XSDsimpleType»

UML Construct

 

Class

Description

 

An XSD simpleType is generated for Classes with this stereotype.

Tagged Values

derivation:
(restriction | list)

Specifies the derivation of the simpleType. See the W3C XML Schema recommendation.

 

length:

 

 

 

 

 

See the W3C XML Schema recommendation.

 

minLength:

 

maxLength:

 

minInclusive:

 

minExclusive:

 

maxInclusive:

 

maxExclusive:

 

totalDigits:

 

fractionDigits:

 

whiteSpace:

 

pattern:

Constraints

 

This Class can only participate in an inheritance relation with another simpleType. It cannot have any attributes or own any associations; they are ignored if present.

«XSDsequence»

UML Construct

 

Class

Description

 

The schema generator creates a sequence model group as the container for the attributes and associations owned by this Class. The model group is in turn added to the model groups of this Class respective owners.

Note:

Tagged values specified by owners of this Class persist through to the child elements of this model group. Thus if memberNames are unqualified for a complexType, so are the children of this model group when added to that complexType.

Tagged Values

 

None.

Constraints

 

This Class must be the destination of unidirectional associations. If it is not, this Class and its connectors are ignored, possibly invalidating other model group Classes.

Inheritance relations are ignored for this Class.

«XSDchoice»

UML Construct

 

Class

Description

 

Creates an XSD choice element. See XSDsequence for more details.

Tagged Values

 

None.

Constraints

 

As for XSDsequence.

«XSDelement»

UML Construct

 

Attribute: AssociationEnd

Description

 

By applying this stereotype to a UML Class attribute or AssociationEnd, the corresponding UML entity is generated as an element within the parent complexType and not as an XSD attribute.

Tagged Values

form:
(qualified | unqualified)

Overrides the schema's elementFormDefault value.

 

position:

Causes the elements to be ordered within a sequence model group of the containing complexType. Duplicated and invalid position Tagged Values are ignored and result in undefined ordering of the UML attributes. Missing position values cause the defined positions to be allocated as specified, with the remaining elements filling the missing positions in an undefined order.

 

anonymousRole:
(true | false)

Specifies if the role name is included in the element declaration for the UML attribute.

 

anonymousType:
(true | false)

Specifies whether the Class type is anonymous for attributes.

 

default

 
See the W3C XML Schema recommendation.

 

fixed

Constraints

 

None.

«XSDattribute»

UML Construct

 

Attribute: AssociationEnd

Description

 

By applying this stereotype to a UML Class attribute or AssociationEnd, the corresponding UML entity is generated as an XSD attribute within the parent complexType and not as an XSD element.

Tagged Values

form:
(qualified | unqualified)

Overrides the schema's attributeFormDefault value.

 

use:
(prohibited | optional | required)

 

See the W3C XML Schema recommendation.

 

default

 

fixed

Constraints

 

The attribute datatype should not see a Class specification, otherwise it is ignored.

«XSDany»

UML Construct

 

Class: Attribute

Description

 

If applied to a UML attribute, an XSD anyAttribute element is generated. If applied to a UML Class, an XSD any element is generated.

Tagged Values

namespace:

 

See the W3C XML Schema recommendation.

 

processContents:
(skip | lax | strict)

Constraints

 

None.

«XSDrestriction»

UML Construct

 

Generalization

Description

 

Overrides the default use of XSD extension for inheritance and generates the child as a complexType with a restriction element instead.

Tagged Values

 

None.

Constraints

 

Applies only to UML Class parent-child relations.

«XSDgroup»

UML Construct

 

Class

Description

 

An XSDgroup is generated for Classes with this stereotype.

Tagged Values

modelGroup:
(sequence | choice | all)

Overrides the default XSD model for generating this group definition.

Constraints

 

A group Class can only associate itself to other group Classes.

A group Class can be associated by another group Class or a complexType Class.

The association should be via an Association connector.

A group Class cannot be inherited/aggregated.

«XSDtopLevelElement»

UML Construct

 

Class

Description

 

Creates an <xs:element> construct which acts as a container for XSDcomplexType and XSDsimpleType Class.

Tagged Values

default

 
See the W3C XML Schema recommendation.

 

fixed

Constraints

 

An XSDtopLevelElement Class can contain either an XSDsimpleType or an XSDcomplexType as its child Class. When such a Class is present as its child, all its inheritance is ignored.

This Class cannot be inherited.

«XSDtopLevelAttribute»

UML Construct

 

Class

Description

 

Creates an <xs:attributr> construct which acts as a container for XSDsimpleType Class.

Tagged Values

use:
(optional | required | prohibited)

 

See the W3C XML Schema recommendation.

 

default

 

fixed

Constraints

 

An XSDtopLevelAttribute Class can contain only an XSDsimpleType Class as its child Class. When such a Class is present as its child, all its inheritance is ignored.

This Class can inherit from only one XSDsimpleType Class.

«XSDunion»

UML Construct

 

Class

Description

 

Creates an <xs:union> construct which can act as a container for XSDsimpleType Class.

Tagged Values

 

None

Constraints

 

An XSDunion Class can contain only XSDsimpleType as its child Class and can generalize from other XSDsimpleType Classes only.

All the Classes that this Class generalizes become the members of the attribute memberTypes.

This Class cannot have any attributes or associations.

«XSDattributeGroup»

UML Construct

 

Class

Description

 

Creates an <XSDattributeGroup> construct which can act as a container for a set of elements for stereotype XSDattribute.

Tagged Values

 

None

Constraints

 

An XSDattributeGroup Class can contain only elements of stereotype XSDattribute and can be associated only with other XSDattributeGroup Classes.

Only XSDcomplexType Classes can associate with this Class.

This Class cannot be inherited.