The XSD transformation modeling feature is enabled when you select the XSD Transformation Profile capability in the General, Capabilities page of the Preferences window.
You can use package, class, property, generalization, association, and dependency UML model elements to model a subset of Extensible Markup language (XML) Schema Definition (XSD) elements. However, the XSD Transformation profile contains stereotypes that you can use to model most XSD schema elements such as simple type, complex type, attribute, element, and reusable groups. The advantage of applying the XSD Transformation profile to the source model and applying the stereotypes of the profile to source model elements is that you can validate your model for errors.
You can select from two templates when you create an XSD modeling project. The templates can accelerate model development by applying the XSD Transformation profile and providing some of the structure that you require for a project.
| Template | Description |
|---|---|
| Blank XSD Model | This template creates a new project and a UML model that has the XSD Transformation profile applied. |
| XSD Model | This template creates a new project and a UML model that has the XSD Transformation profile applied. The XSD model contains some structure, including a package called XSD Model Building Blocks. This package contains model content that you can use to help you build the XSD model. The building blocks have the necessary model libraries imported and the XSD stereotypes applied. |
You can create specific XSD schema elements with their appropriate stereotype automatically applied. When adding shapes to class and free form diagrams, the Palette provides XSD tools to generate the modeling artifacts used by the UML-to-XSD transformation. In the Project Explorer view and diagram editor, you can use the Add XSD command found on the pop-up menus to add various XSD schema elements depending on the context of your selection.
If you do not need to describe the elements of the schema that you are modeling in detail, you can alternately use keywords to indicate how the transformation should generate XSD elements.
The following table lists the stereotypes of the profile and their related properties and values.
| Stereotype | Applicable element | Properties | Property description and values | Transformation result |
|---|---|---|---|---|
| «annotation» | Comment | kind | Type of annotation: documentation, appinfo | Annotation |
| language | Natural language of annotation | |||
| source | Source of annotation | |||
| «attribute» | Class property | form | Specifies whether the attribute name is qualified
in the instance document
|
Attribute in a complex attribute group if it is a simple type and its multiplicity is [0..1] |
| use | Specifies if the attribute is optional or required
|
|||
| «attributeGroup» | Class | Attribute group | ||
| «complexType» | Class | anonymous | true | No top-level complex type declaration is generated. References to this class are generated as attributes or element declarations where the type of the attribute or element is the anonymous type |
| false (default) | Complex type | |||
| block | Specifies whether to block type substitution
|
|||
| final | Specifies whether other types can be derived
from this type
|
|||
| modelGroup | Specifies the content model of the type
|
|||
| maxOccurs, minOccurs | Specifies the minimum and maximum number of
times the sequence and choice group may occur in the complex type For an all model group, maxOccurs must be 1 and minOccurs must be 0 or 1 |
|||
| mixed | Specifies whether the complex type allows mixed
content.
|
|||
| «element» | Property of a class | block | Blocks substitution of derived types, allowing only the original type to be used in an instance
|
Attribute |
| final | Applies to global elements and specifies that
other types cannot derive from global element types
|
|||
| form | Specifies whether the element name must be qualified
in the instance document
|
|||
| nillable | Specifies whether xsi::nil can be used in the instance for this element; its value is set to false by default | |||
| «enumeration» | Class | anonymous |
|
XSD enumeration if the class has a generalization relationship to another class that represents a simple type |
| «global» | Class | The class must only have one property | Top-level element declaration |
|
| «listOf» | Dependency | XSD list from the client of the dependency Item type is the supplier of the dependency |
||
| «modelGroup» | Class | anonymous | If true, no top-level group declaration is generated in the schema and references to this class are transformed into a model group reference | Mamed model group that is global
and reusable. By default, the transformation creates a sequence model. References to this class are transformed into a model group reference |
| modelGroup | Specifies the content model of the group
|
|||
| «redefine» | Generalization | New schema that contains the redefined components and the unchanged components from the original schema | ||
| «restriction» | Generalization | Schema simple types with a restriction of the possible values to match a pattern specified by a regular expression | ||
| «schema» | Package | attributeFormDefault | Specifies whether local attribute declarations
should use qualified names
|
XSD schema that has the same name as the package |
| blockDefault | Specifies the default value of the block attribute
of the complex type and element declarations The block attribute determines whether to block element substitution or type substitution
|
|||
| elementFormDefault | Specifies whether local element declarations
should use qualified names
|
|||
| finalDefault | Specifies the default value for the final attribute
of the complex type, simple type and element declarations The final attribute specifies if type derivation can occur
|
|||
| targetNamespace targetNamespacePrefix | Overrides the targetNamespace and the targetNamespacePrefix values specified in the transformation configuration | |||
| «simpleType» | Class | anonymous | true | Class is treated as an anonymous type and no top-level type declaration is generated |
| false | Simple type if the class has a generalization to an XSD built-in data type, another simple type, or an XSD enumeration | |||
| final | Specifies if other types can be derived from
this type
|
|||
Note: For more information about facet definition, see XSD facets
|
Represent facets that the XSD schema defines
to specify:
Note: Not all of the facets listed apply to all simple types,
for more information see Simple types and applicable facets of UML-to-XSD transformations
|
|||
| «unionOf» | Dependency | XSD union is generated from the client of the
dependency with the supplier of the dependency as a member A class that represents more than one simple type can have more than one such dependency to different classes that represent simple types |
||
| «wildcard» | Property of a class | processContents | Specifies how to validate the replacement of
attributes and elements
|
Element wildcard If the property has the attribute keyword or the «attribute» stereotype, an attribute wildcard is also generated |
| namespace | Specifies the namespaces that can contain the
replacement attributes or elements
|