Two UML-to-XSD transformations are available: UML-to-XSD and UML-to-XSD (Deprecated). The UML-to-XSD transformation replaces UML-to-XSD (Deprecated); no new features are planned for the UML-to-XSD (Deprecated) transformation.
An XSD file is an instance of an XML schema that is written in the XML Schema language. An XSD file, or schema, describes the structure of an XML file. It also defines the elements and attributes that can be included in an XML schema, the relationships between the elements and attributes, as well as the constraints on the elements and attributes. You first model the structure of an XML schema by applying a set of UML-to-XSD mapping rules. You then apply the UML-to-XSD transformation to the model to generate an XSD file, which you can use to validate an XML file.
You can use UML to create a visual representation of an XML schema, and then you can run the UML-to-XSD transformation to generate an XSD file. A model can contain elements that represent XSD elements, as well as elements that are not related to XSD.
Use the following guidelines when you create UML models that represent XML schemas:
By default, the transformation generates a schema for each package and its contents that you select in the source model. You can specify whether the UML-to-XSD transformation generates a schema for packages that do not have the «schema» stereotype or schema keyword. The transformation does not generate a schema for a nested package.
By default, the transformation processes all classes contained in the packages that you select as the source of the transformation. You can specify whether the UML-to-XSD transformation processes classes that do not have a stereotype or keyword.
You can specify any project or folder in your workspace as the target for the output of the UML-to-XSD transformation.
The XSD file that the UML-to-XSD (Deprecated) transformation generates is stored in a directory, called schema, in the project that you specify as the target for the transformation output. The file that contains the schema has the same name as the package in the source model. The generated schema has .xsd as its file name extension. The transformation displays the generated schema in the Navigator view.
The location of the UML-to-XSD transformation output depends on the value set for the Target folder property. The additional options enable the output to be created in a package name or names of your choice and enable the creation of separate files for each data type to support IBM® WebSphere® Integration Developer projects.
The following table lists how the UML-to-XSD transformation transforms UML model elements in XSD elements.
| UML model element | XSD schema element |
|---|---|
| Package | Single namespace with a prefix |
| Class | Types and reusable groups:
|
| Enumeration | Restriction of an XSD string simple type with enumeration
facets that are equal to the UML enumeration literals Note: This differs
from a UML class with the «enumeration» stereotype from the UML-to-XSD
transformation profile. A stereotyped UML class provides additional
general XSD enumerations.
|
| Properties of a class | Attributes of an attribute group Elements and attributes of a complex type Elements and attributes of a named model group |
| Property with attribute stereotype | Attribute of the complex type, if the property is a simple type and has a multiplicity of [0..1]; otherwise, converted into an element |
| Association (Aggregation) | Child element of a contained element (complex type) |
| Generalization | Derivation by extension of complex type |
The transformation provides integration functionality with IBM Rational® Team Concert, CVS, Rational ClearCase®, and Rational ClearCase LT version control systems, which enables you to automatically check out files or add new files. You must enable team capabilities to work with configuration management systems.