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

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 UTC