XSD transformation profile

Use the stereotypes in the XSD Transformation profile to represent XSD elements such as simple type, complex type, attributes, elements, and reusable groups.

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.

XSD model project templates

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.

Support for creating XSD schema elements

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
  • qualified
  • unqualified
  • default
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
  • optional (default)
  • 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
  • #all, prevents derived types from substituting this type
  • extension, prevents extensions of this type
  • restriction, prevents any restriction from substituting this type
  • extension restriction, same effect as #all
final Specifies whether other types can be derived from this type
  • #all, prevents derivation of this type by other types
  • extension
  • restriction
  • extension restriction
modelGroup Specifies the content model of the type
  • all, anonymous must be set to false
  • choice
  • sequence
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.
  • false (default)
  • true
«element» Property of a class block

Blocks substitution of derived types, allowing only the original type to be used in an instance

  • #all, prevents the use of derived types in place of original types in an instance
  • extension, prevents extensions of a type from substituting for the type
  • "extension restriction" or "restriction extension", same effect as #all
  • " ", empty string, indicates no restrictions; overrides the blockDefault value of the schema element
Attribute
final Applies to global elements and specifies that other types cannot derive from global element types
  • #all
  • extension
  • restriction
  • extension restriction
form Specifies whether the element name must be qualified in the instance document
  • qualified
  • unqualified
  • default, defaults to the value of elementFormDefault of the schema stereotype, which defaults to unqualified
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
  • true
  • false (default)
If true, no top-level simple type declaration with enumeration facets is created in the schema and references to this class are generated as attribute or element declarations with the anonymous type as the type of the attribute or element
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
Attribute declaration, if the property has the <<attribute>>
Name and type are the same as the property name and type

«listOf» Dependency     XSD list from the client of the dependency

Item type is the supplier of the dependency

There can only be one such dependency between two classes that represent a simple type

«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
  • all, anonymous must be set to false
  • choice
  • sequence (default)
«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
  • qualified
  • unqualified (default)
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

  • #all
  • a list of one or more of the following keywords, separated by a space: extension, restriction or substitution
elementFormDefault Specifies whether local element declarations should use qualified names
  • qualified
  • unqualified (default)
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

  • #all
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
  • #all, no derivation allowed
  • extension
  • restriction
  • list
  • union
  • fractionDigits
  • length
  • maxExclusive
  • maxInclusive
  • maxLength
  • minExclusive
  • minInclusive
  • minLength
  • pattern
  • totalDigits
  • whiteSpace
Note: For more information about facet definition, see XSD facets
Represent facets that the XSD schema defines to specify:
  • Valid ranges of values
  • Constraints on values
  • Length and precision of values
  • Regular expressions that valid values must match
  • Processing of the white space of simple types that are derived by restriction from built-in XSD types
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
  • skip, no validation
  • lax, validates attributes and elements which have retrievable declarations and raises errors for invalid values
  • strict, looks for a schema document for the namespace and validates attributes and elements (default)
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
  • ##any, any namespace or no namespace
  • ##other, any namespace other than the target namespace of the document or if the schema document has no target namespace, any namespace
  • anyURI
  • ##targetNamespace, target namespace of the schema document
  • ##local, no namespace is required
Whitespace-separated list of any of the following items:
  • ##targetNamespace
  • #local, specific namespaces
  • ##local


Feedback