W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2004

Re: XSD - Possibility of "enumeration" with defined order of elements

From: Bob Schloss <rschloss@us.ibm.com>
Date: Tue, 15 Jun 2004 14:14:17 -0400
To: "Jonny Pony" <jonnypony666@hotmail.com>
Cc: xmlschema-dev@w3.org
Message-ID: <OF2D10AE06.63BBA3F4-ON85256EB4.00635F58-85256EB4.00642F72@us.ibm.com>





Hi Jonny,

      Did you intend your example to have
    <xs:element name="Column" type="Column" minOccurs="4" maxOccurs="4"/>
or with at least some value for minOccurs and maxOccurs?

      Do you intend to allow any columns to be skipped,
although those that used
must appear in your specified order?
If so, I do not think you can do this in
W3C XML Schema 1.0.

      If you always want the columns in the fixed order (no skipping),
I think you can do something like:

<xs:complexType name="ColumnHeader">
  <xs:sequence>
    <xs:element name="Column" type="ColumnSpaltenname"/>
    <xs:element name="Column" type="ColumnDatentyp"/>
    <xs:element name="Column" type="ColumnColumnSize"/>
    <xs:element name="Column" type="ColumnDezimalstellen"/>
  </xs:sequence>
</xs:complexType>

<xs:simpleType name="Column">
  <xs:restriction base="xs:string">
    <xs:enumeration value="Spaltenname"/>
    <xs:enumeration value="Datentyp"/>
    <xs:enumeration value="Column Size"/>
    <xs:enumeration value="Dezimalstellen"/>
  </xs:restriction>
</xs:simpleType>

<xs:simpleType name="ColumnSpaltenname">
  <xs:restriction base="Column">
    <xs:enumeration value="Spaltenname"/>
  </xs:restriction>
</xs:simpleType>

<xs:simpleType name="ColumnDatentyp">
  <xs:restriction base="Column">
    <xs:enumeration value="Datentyp"/>
  </xs:restriction>
</xs:simpleType>

<xs:simpleType name="ColumnColumnSize">
  <xs:restriction base="Column">
    <xs:enumeration value="Column Size"/>
  </xs:restriction>
</xs:simpleType>

<xs:simpleType name="ColumnDezimalstellen">
  <xs:restriction base="Column">
    <xs:enumeration value="Dezimalstellen"/>
  </xs:restriction>
</xs:simpleType>

Good Luck,
Bob Schloss

Scalable XML Infrastructure
IBM Thomas J Watson Research Center
Yorktown Heights, New York, USA
http://www.research.ibm.com/XML







                                                                           
             "Jonny Pony"                                                  
             <jonnypony666@hot                                             
             mail.com>                                                  To 
             Sent by:                  xmlschema-dev@w3.org                
             xmlschema-dev-req                                          cc 
             uest@w3.org                                                   
                                                                   Subject 
                                       XSD - Possibility of "enumeration"  
             06/15/2004 12:16          with defined order of elements      
             PM                                                            
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           





Hi,

my xsd:

...
<xs:complexType name="ColumnHeader">
  <xs:sequence>
    <xs:element name="Column" type="Column"/>
  </xs:sequence>
</xs:complexType>

<xs:simpleType name="Column">
  <xs:restriction base="xs:string">
    <xs:enumeration value="Spaltenname"/>
    <xs:enumeration value="Datentyp"/>
    <xs:enumeration value="Column Size"/>
    <xs:enumeration value="Dezimalstellen"/>
  </xs:restriction>
</xs:simpleType>

I want the enumerated elements in a defined order, like in <xs:sequence>.

Wanted (only valid) xml-output. The <column>-elements must appear in this
order:
...
<Section>
  <ColumnNames>
    <Column>Spaltenname</Column>
    <Column>Datentyp</Column>
    <Column>Column Size</Column>
    <Column>Dezimalstellen</Column>
  </ColumnNames>
</Section>

Is there a possiblility to do that?

Cheers
Jonny

_________________________________________________________________
Die ultimative Fan-Seite für den MSN Messenger http://www.ilovemessenger.de

Emoticons und Hintergründe kostenlos downloaden!
Received on Tuesday, 15 June 2004 14:16:19 GMT

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