XSD Transformation

The XSD transformation converts Platform-Independent Model (PIM) elements to UML Profile for XML elements as an intermediary step in creating an XML Schema. Each selected PIM Class element is converted to an «XSDcomplexType» element.

Example

The PIM elements

PIM

 

After transformation become the PSM elements

PSM_XSD

 

These in turn generate this 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

Learning Center topics

(Alt+F1) | Enterprise Architect | SOA and XML Engineering | XSD | UML to XML Schema