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/08/08 16:16:35 UTC

DO NOT REPLY [Bug 22250] New: - xs:sequence Xerces does not select correct sequence during validation

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=22250>.
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=22250

xs:sequence Xerces does not select correct sequence during validation

           Summary: xs:sequence Xerces does not select correct sequence
                    during validation
           Product: Xerces2-J
           Version: 2.5.0
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: SAX
        AssignedTo: xerces-j-dev@xml.apache.org
        ReportedBy: xerces@postbox.to


The following schema and instance document are valid according to XMLSpy 5.0 , 
however Xerces fails to validate the document correctly. The problem is with 
the third element of the schema , which Xerces does not process correctly.

Xerces appears to get confused with multiple consecutive elements having the 
same name but slightly different signatures. Xerces does not recognise which 
xs:sequence the instance document is to validate against.

The error returned by Xerces is:
Line 16 , Column 13 : cvc-complex-type.2.4.a: Invalid content was found 
starting with element 'LastName'. One of '{"":Gender}' is expected

The example schema is:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:element name="Base">
		<xs:complexType>
			<xs:sequence>
				<xs:sequence>
					<xs:element name="Person">
						<xs:complexType>
							<xs:sequence>
								<xs:element 
name="FirstName" type="xs:string"/>
								<xs:element 
name="Age" type="xs:positiveInteger"/>
							</xs:sequence>
						</xs:complexType>
					</xs:element>
				</xs:sequence>
				<xs:sequence>
					<xs:element name="Person" 
minOccurs="0" maxOccurs="unbounded">
						<xs:complexType>
							<xs:sequence>
								<xs:element 
name="FirstName" type="xs:string"/>
								<xs:element 
name="Gender" type="xs:string"/>
							</xs:sequence>
						</xs:complexType>
					</xs:element>
				</xs:sequence>
				<xs:sequence>
					<xs:element name="Person" 
minOccurs="0" maxOccurs="unbounded">
						<xs:complexType>
							<xs:sequence>
								<xs:element 
name="FirstName" type="xs:string"/>
								<xs:element 
name="LastName" type="xs:string"/>
								<xs:element 
name="Gender" type="xs:string" minOccurs="0"/>
								<xs:element 
name="Age" type="xs:positiveInteger"/>
							</xs:sequence>
						</xs:complexType>
					</xs:element>
				</xs:sequence>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>

The test XML instance document is:
<Base>
	<Person>
		<FirstName>Fred</FirstName>
		<Age>26</Age>
	</Person>
	<Person>
		<FirstName>James</FirstName>
		<Gender>Male</Gender>
	</Person>
	<Person>
		<FirstName>Sally</FirstName>
		<Gender>Female</Gender>
	</Person>
	<Person>
		<FirstName>Joe</FirstName>
		<LastName>Smith</LastName>
		<Gender>Male</Gender>
		<Age>34</Age>
	</Person>
</Base>

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