前页 后页

XSD转换

XSD转换将平台独立模型(PIM)元素转换为XML元素的UML概要文件,作为创建XML模式的中间步骤。每个选定的PIM类元素都将转换为«XSDcomplexType»元素。

PIM元素

Platform Independent Model (PIM) in Sparx Systems Enterprise Architect.

转换后成为PSM元素

XSD Platform Specific Model (PSM) in Sparx Systems Enterprise Architect.

这些反过来生成此XSD

<?xml版本=“ 1.0”编码=“ ISO-8859-1”?>

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

<xs:element name =“ Account” type =“ Account” />

<xs:complexType name =“帐户”>

<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 =“交易” type =“交易” />

<xs:complexType name =“交易”>

<xs:sequence>

<xs:element name =“ date” type =“ xs:date” />

<xs:element name =“ orderNumber” type =“ xs:string” />

<xs:element ref =“帐户” />

<xs:element ref =“ LineItem” />

</ xs:sequence>

</ xs:complexType>

</ xs:schema>

学到更多