W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2001

Attribute Restriction

From: Curtis Hatter <cmhatter@andersonpublishing.com>
Date: Mon, 5 Mar 2001 12:54:03 -0500
Message-ID: <001001c0a59d$48d34df0$4764a8c0@editorial.andersonpublishing.com>
To: <xmlschema-dev@w3.org>
Hi,

Currently working on a schema where I defined a top level complexType called caseSegmentDef. This type contains an attribute which references an enumeration of values. Here's a trimmed down example:

<xsd:complexType name="caseSegmentType">
    <!-- complexContent here -->
    <xsd:attribute name="type" type="caseSegmentType" />
</xsd:complexType>

<xsd:simpleType name="caseSegmentType">
    <xsd:restriction base="xsd:string">
        <xsd:enumeration value="concur" />
        <xsd:enumeration value="dissent" />
        <xsd:enumeration value="judge" />
        <xsd:enumeration value="opinion />
        <!-- more values here -->
    </xsd:restriction>
</xsd:simpleType>

The actual question I have is inside the top level element case i want to reference caseSegmentDef, but to make it appear in a certain sequence depending on the attribute (caseSegmentType). I read through XML Schema Part 0: Primer and while some of the things looked promising none of them seemed to work for what i'm trying to do. Here's the top level element (haven't gotten very far):

<xsd:element name="case">
    <xsd:complexType>
        <xsd:sequence>
            <!-- here i want to order the caseSegment elements based on the attribute -->
        </xsd:sequence>
    <xsd:attribute name="newCase" type="xsd:boolean" />
    <xsd:attribute name="reported" type="xsd:boolean" />
<xsd:element>

Thanks for any help you can provide and sorry if I wasn't very clear.

Curtis Hatter
Received on Monday, 5 March 2001 13:01:13 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:20 GMT