UML Profile for XSD

Return to Introduction  Previous page  Next page

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 Enterprise Architect UML 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. 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. 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 W3C XML 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:

See the W3C XML Schema recommendation.

 

maxLength:

See the W3C XML Schema recommendation.

 

minInclusive:

See the W3C XML Schema recommendation.

 

minExclusive:

See the W3C XML Schema recommendation.

 

maxInclusive:

See the W3C XML Schema recommendation.

 

maxExclusive:

See the W3C XML Schema recommendation.

 

totalDigits:

See the W3C XML Schema recommendation.

 

fractionDigits:

See the W3C XML Schema recommendation.

 

whiteSpace:

See the W3C XML Schema recommendation.

 

pattern:

See the W3C XML Schema recommendation.

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.

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:

See the W3C XML Schema recommendation.

 

fixed:

See the W3C XML Schema recommendation.

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)

See the W3C XML Schema recommendation.

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

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

 

None

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. 

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