xmlspy validation bug with cos-element-consistent

Consider the following example schema.  XmlXpy says both examples are
valid if you hit the validation button while in schema view.  But in
text
view it says the first example is not valid.  Even in test view it says
the second
example in valid.  Xerces says both examples are not valid.

As a C++ programming my overloading instincts make me want the
funtionality
displayed in these examples.  Help me understand why XmlSpy validates
one
way in schema view and another way in text view; and also help me
understand
why my examples should not be valid. Please.

BEGIN EXAMPLE
--------------------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.3 U (http://www.xmlspy.com) by Scott-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
 <xs:element name="root">
  <xs:complexType>
   <xs:sequence>
    <xs:element name="example1">
     <xs:annotation>
      <xs:documentation>Example of the W3C error:
cos-element-consistent</xs:documentation>
     </xs:annotation>
     <xs:complexType>
      <xs:choice>
       <xs:element name="mydate" type="xs:date">
        <xs:annotation>
         <xs:documentation>date</xs:documentation>
        </xs:annotation>
       </xs:element>
       <xs:element name="mydate" type="xs:dateTime">
        <xs:annotation>
         <xs:documentation>date time</xs:documentation>
        </xs:annotation>
       </xs:element>
      </xs:choice>
     </xs:complexType>
    </xs:element>
    <xs:element name="example2">
     <xs:annotation>
      <xs:documentation>More subtle version</xs:documentation>
     </xs:annotation>
     <xs:complexType>
      <xs:choice>
       <xs:sequence>
        <xs:element name="mydate" type="xs:date">
         <xs:annotation>
          <xs:documentation>date</xs:documentation>
         </xs:annotation>
        </xs:element>
        <xs:element name="myValue" type="xs:double"/>
       </xs:sequence>
       <xs:sequence>
        <xs:element name="mydate" type="xs:dateTime">
         <xs:annotation>
          <xs:documentation>date time</xs:documentation>
         </xs:annotation>
        </xs:element>
        <xs:element name="myValue" type="xs:double"/>
       </xs:sequence>
      </xs:choice>
     </xs:complexType>
    </xs:element>
   </xs:sequence>
  </xs:complexType>
 </xs:element>
</xs:schema>
------------------------------------------------------------------
END EXAMPLE

Received on Wednesday, 24 April 2002 04:08:33 UTC