[
Lists Home |
Date Index |
Thread Index
]
I am trying to define a schema for Latitide/Longitude such that it can be
expressed as degrees, minutes, and seconds.
Normally, the restrictions would be (for latitude) degrees > 90, minutes >
60, and seconds > 60
The problem is that 90d0m0s is also a valid latitude.
My colleague who swears by XML Spy (while I just swear at it) came up with this:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="LatitudeType">
<xs:choice>
<xs:sequence>
<xs:element name="deg">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:maxInclusive value="90"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="min" type="xs:decimal" fixed="0"/>
<xs:element name="sec" type="xs:decimal" fixed="0"/>
<xs:element name="dir">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="N"/>
<xs:enumeration value="n"/>
<xs:enumeration value="S"/>
<xs:enumeration value="s"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
<xs:sequence>
<xs:element name="deg">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="0"/>
<xs:maxExclusive value="90"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="min">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="0"/>
<xs:maxExclusive value="60"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="sec" fixed="0">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="0"/>
<xs:maxExclusive value="60"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="dir">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="N"/>
<xs:enumeration value="n"/>
<xs:enumeration value="S"/>
<xs:enumeration value="s"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:choice>
</xs:complexType>
</xs:schema>
Oxygen, the editor I use, says it is invalid.
E cos-element-consistent: Error for type 'LatitudeType'. Multiple elements
with name 'deg', with different types, appear in the model group.
E cos-nonambig: "":deg and "":deg (or elements from their substitution
group) violate "Unique Particle Attribution". During validation against
this schema, ambiguity would be created for those two particles.
Is there a valid way to to this ?
|