RE: Schema for Point Value

Define a list-type of floats with length set to 3:

    <xs:simpleType name="list-of-floats">
        <xs:restriction>
            <xs:simpleType>
                <xs:list itemType="xs:float"/>
            </xs:simpleType>
            <xs:length value="3"/>
        </xs:restriction>
    </xs:simpleType>

Anli Shundi

TIBCO Software Inc.

www.tibco.com

  -----Original Message-----
  From: www-xml-schema-comments-request@w3.org
[mailto:www-xml-schema-comments-request@w3.org]On Behalf Of Tanner, Thomas
L. (by way of "C. M. Sperberg-McQueen" <cmsmcq@acm.org>)
  Sent: Thursday, August 14, 2003 9:50 AM
  To: W3C XML Schema Comments list
  Subject: Schema for Point Value



  I am having trouble defining the schema necessary to validate a point
which consists of three floating point values:

          <Point>50.000000 50.000000 10.000000</Point>

  I have attempted to use the following schema definition:

          <xs:element name="Point" type="xs:float" minOccurs="0"/>

  However, this works only if there is one floating point value, not 3.

  I have also attempted to validate this with the following schema, with the
base type as a string and using regular expression pattern matching:

                                  <xs:element name="Point" minOccurs="0">
                                          <xs:simpleType>
                                                  <xs:restriction
base="xs:string">
                                                          <xs:pattern
value='([+-]?[0-9]+\.[0-9]*((e|E)("+"|"-")[0-9]+)?)+'/>

                                                  </xs:restriction>
                                          </xs:simpleType>
                                  </xs:element>

  Again, this works only if there is one floating point value, not 3.

  Is there a way to define the schema to validate three floating point
values?

Received on Thursday, 14 August 2003 12:02:51 UTC