Abstract XSD models

XML schemas can also be modeled using simple, abstract Class models. This can be useful in enabling an architect to start working at a higher level of abstraction, without concern for the implementation details of a Schema. Such an abstract model can be refined further using the XML Schema pages of the Toolbox, or it can be generated directly by Enterprise Architect's Schema Generator. In this case, a set of default mappings is assumed by the schema generator to convert the abstract model to an XSD file.





The following is a simplified version of the Employee Details example model, which does not use XSD-specific stereotypes or Tagged Values:



The following schema fragment would be generated by Enterprise Architect, given the above model:


<?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="Full-Time"/>

                 <xs:enumeration value="Part-Time"/>

                 <xs:enumeration value="Casual"/>

                 <xs:enumeration value="Contract"/>



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

 <xs:complexType name="Person">


                 <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:element name="Employee" type="Employee"/>

 <xs:complexType name="Employee">


                 <xs:extension base="Person">


                                 <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:element name="EmployeeRecords" type="EmployeeRecords"/>

 <xs:complexType name="EmployeeRecords">


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



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

 <xs:complexType name="ContactInfo">


                 <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"/>




Learn More: