- From: Robert McCarthy <rmccarthy@vasocor.com>
- Date: Wed, 22 May 2002 10:30:16 -0400 (EDT)
- To: <xmlschema-dev@w3c.org>
Is the following syntax valid? Is there a better way to specify this block of statements? Perhaps some explanation will help. I have an element named "height" that will be entered on a user interface in any one of the following formats: feet and inches, just inches, or just centimeters. The business logic will always convert these values to inches before saving them in an XML file, and the value of inches must be between 36.0 and 100.0, inclusive. I have three attributes: (1) "units" which will always be "inches", (2) "display1" will either contain "ft" or nothing, and (3) "display2" will either contain "in" or "cm". "display1" and "display2" are used to indicate how to convert and display "height" to the proper format and value when displaying it on the user interface. Thanks! - Robert <xs:element name="height"> <xs:complexType> <xs:restriction base="xs:float"> <xs:minInclusive value="36.0"/> <xs:maxInclusive value="100.0"/> </xs:restriction> <xs:attribute name="units" use="required"> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="in"/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name="display1" use="required"> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="ft"/> <xs:enumeration value=""/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name="display2" use="required"> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="in"/> <xs:enumeration value="cm"/> </xs:restriction> </xs:simpleType> </xs:attribute> </xs:complexType> </xs:element>
Received on Friday, 24 May 2002 05:05:45 UTC