RE: Schema for Point Value

You can define a list datatype consisting of float values with a length
of 3.

 

Or you could write a Schema that would validate the following markup:

 

<point>

    <coordinate> 50.0000</coordinate>

    <coordinate> 50.0000</coordinate>

    <coordinate> 10.0000</coordinate>

</point>

 

All the best, Ashok 

________________________________

From: www-xml-schema-comments-request@w3.org
[mailto:www-xml-schema-comments-request@w3.org] On Behalf Of Tanner,
Thomas L.
Sent: Thursday, August 14, 2003 6: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 10:18:31 UTC