You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2003/10/31 13:45:02 UTC

DO NOT REPLY [Bug 24290] New: - Choice containing sequence does no validate correctly

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24290>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24290

Choice containing sequence does no validate correctly

           Summary: Choice containing sequence does no validate correctly
           Product: Xerces2-J
           Version: 2.5.0
          Platform: Other
        OS/Version: Windows XP
            Status: NEW
          Severity: Major
          Priority: Other
         Component: XML Schema Structures
        AssignedTo: xerces-j-dev@xml.apache.org
        ReportedBy: neil@integility.com


Hi,

I have a "Version" type which is defined as containing at least one of
"VersionNo" and "VersionDateTime". It must contain exactly one of those
children, or both of them.

As far as I can tell the only way to define this in Schema is as follows:

<xs:complexType name="VersionType">
  <xs:choice>
    <xs:element name="VersionNo" type="xs:integer"/>
    <xs:element name="VersionDateTime" type="xs:dateTime"/>
    <xs:sequence>
      <xs:element name="VersionNo" type="xs:integer"/>
      <xs:element name="VersionDateTime" type="xs:dateTime"/>
    </xs:sequence>
  </xs:choice>
</xs:complexType>

However when I create an instance document containing both nodes:

<Version>
  <VersionNo>1</VersionNo>
  <VersionDateTime>2003-10-31T15:00:00</VersionDateTime>
<Version>

... which, incidentally, validates correctly in XMLSpy, I get the following
validation error from Xerces:

cvc-complex-type.2.4.d: Invalid content was found starting with element
'VersionDateTime'. No child element is expected at this point.

This applies to both 2.4.0 and 2.5.0

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org