Another disagreement with XML Spy
Posted: Wed Jul 28, 2004 5:06 pm
Hey, George !! I have another one:
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:
Oxygen says it is invalid.
Is there a valid way to to this ?
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:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v2004 rel. 4 U (http://www.xmlspy.com) by Dan White (NGIT-DMS) -->
<xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified" 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>
Code: Select all
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.