cpfaff / ease

EASE (Essential Annotation Schema for Ecology)
0 stars 2 forks source link

Flatten the schema #8

Closed cpfaff closed 8 years ago

cpfaff commented 8 years ago

This allows for better reuse of components. The schema first defines all elements and attributes and then uses references to build up complex type elements. An example for a generic list:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="item" type="xs:string"/>
    <xs:attribute name="of" type="listType"/>
    <xs:element name="list">
    <xs:complexType>
        <xs:sequence>
        <xs:element ref="item"/>
        </xs:sequence>
        <xs:attribute ref="listType"/>
    </xs:complexType>
    </xs:element>
    <xs:simpleType name="listType">
    <xs:restriction base="xs:string">
        <xs:enumeration value="organisms"/>
        <xs:enumeration value="locations"/>
    </xs:restriction>
    </xs:simpleType>
</xs:schema>