预订演示

请注意 : 本帮助页面不适用于最新版本的Enterprise Architect. 最新的帮助文档在这里.

前页 后页

抽象类模型中的XML

您只能使用简单的抽象类模型对XML模式进行建模。例如,这使架构师可以在更高的抽象层次上开始工作而无需担心Schema的实现细节。虽然随后可以使用工具箱的“ XML Schema”页面完善这种抽象模型,但也可以直接由Enterprise Architect的Schema Generator生成该抽象模型,在这种情况下,Schema Generator应用一组默认映射来转换XSD文件的抽象模型。

结构体

详情

图表

这是早期Employee Details示例模型的简单Class元素版本。它不使用特定于XSD的构造型或标记值。

This is a simple Class element version of an Employee Details example model. It does not use XSD-specific stereotypes or tagged values.

架构图

可以从示例模型生成此架构片段:

<?xml version =“ 1.0”?>

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

<xs:simpleType name =“ Status”>

<xs:restriction base =“ xs:string”>

<xs:enumeration value =“全职” />

<xs:enumeration value =“ Part-Time” />

<xs:enumeration value =“ Casual” />

<xs:enumeration value =“ Contract” />

</ xs:restriction>

</ xs:simpleType>

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

<xs:complexType name =“ Person”>

<xs:sequence>

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

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

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

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

<xs:element name =“ contactDetails” type =“ ContactInfo” />

</ xs:sequence>

</ xs:complexType>

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

<xs:complexType name =“ Employee”>

<xs:complexContent>

<xs:extension base =“ Person”>

<xs:sequence>

<xs:element name =“ status” type =“ Status” />

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

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

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

</ xs:sequence>

</ xs:extension>

</ xs:complexContent>

</ xs:complexType>

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

<xs:complexType name =“ EmployeeRecords”>

<xs:sequence>

<xs:element name =“ Employee” type =“ Employee” minOccurs =“ 0” maxOccurs =“ unbounded” />

</ xs:sequence>

</ xs:complexType>

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

<xs:complexType name =“ ContactInfo”>

<xs:sequence>

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

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

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

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

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

</ xs:sequence>

</ xs:complexType>

</ xs:schema>

学到更多