XSD Transformation

The purpose of the XSD transformation is to convert Platform-Independent Model (PIM) elements to UML Profile for XML elements as an intermediary step to creating an XML Schema. Each selected PIM Class element is converted to an XSDcomplexType element.

Example

The Platform-Independent Model (PIM):

PIM

After transformation becomes the PSM:

PSM_XSD

Which in turn generates the following XSD:

 

<?xml version="1.0" encoding="ISO-8859-1"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

 <xs:element name="Account" type="Account"/>

 <xs:complexType name="Account">

         <xs:sequence>

                 <xs:element name="name" type="xs:string"/>

                 <xs:element name="billingAddress" type="xs:string"/>

                 <xs:element name="emailAddress" type="xs:string"/>

                 <xs:element name="closed" type="xs:boolean"/>

                 <xs:element name="deliveryAddress" type="xs:string"/>

                 <xs:element ref="Order"/>

                 <xs:element ref="ShoppingBasket"/>

         </xs:sequence>

 </xs:complexType>

 <xs:element name="LineItem" type="LineItem"/>

 <xs:complexType name="LineItem">

         <xs:sequence>

                 <xs:element name="quantity" type="xs:integer"/>

                 <xs:element ref="StockItem"/>

         </xs:sequence>

 </xs:complexType>

 <xs:element name="Order" type="Order"/>

 <xs:complexType name="Order">

         <xs:sequence>

                 <xs:element name="date" type="xs:date"/>

                 <xs:element name="deliveryInstructions" type="xs:string"/>

                 <xs:element name="orderNumber" type="xs:string"/>

                 <xs:element ref="LineItem"/>

                 <xs:element name="status" type="OrderStatus"/>

         </xs:sequence>

 </xs:complexType>

 <xs:simpleType name="OrderStatus">

         <xs:restriction base="xs:string">

                 <xs:enumeration value="new"/>

                 <xs:enumeration value="packed"/>

                 <xs:enumeration value="dispatched"/>

                 <xs:enumeration value="delivered"/>

                 <xs:enumeration value="closed"/>

         </xs:restriction>

 </xs:simpleType>

 <xs:element name="ShoppingBasket" type="ShoppingBasket"/>

 <xs:complexType name="ShoppingBasket">

         <xs:sequence>

                 <xs:element ref="LineItem"/>

         </xs:sequence>

 </xs:complexType>

 <xs:element name="StockItem" type="StockItem"/>

 <xs:complexType name="StockItem">

         <xs:sequence>

                 <xs:element name="catalogNumber" type="xs:string"/>

         </xs:sequence>

 </xs:complexType>

 <xs:element name="Transaction" type="Transaction"/>

 <xs:complexType name="Transaction">

         <xs:sequence>

                 <xs:element name="date" type="xs:date"/>

                 <xs:element name="orderNumber" type="xs:string"/>

                 <xs:element ref="Account"/>

                 <xs:element ref="LineItem"/>

         </xs:sequence>

 </xs:complexType>

</xs:schema>

 

Learn more

For more information, see the Generate XSD topic