You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by bu...@apache.org on 2002/10/04 16:13:05 UTC

DO NOT REPLY [Bug 13293] New: - Schema ID validation can fail depending on declaration ordering

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

Schema ID validation can fail depending on declaration ordering

           Summary: Schema ID validation can fail depending on declaration
                    ordering
           Product: Xerces-C++
           Version: 2.1.0
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Validating Parser (Schema) (Xerces 1.5 or up only)
        AssignedTo: xerces-c-dev@xml.apache.org
        ReportedBy: alby@exceloncorp.com


Running "saxcount -n -s" on the attached XML (that refers to the attached XML 
schema) results in this error:

Error at file c:\testcase.xsd, line 5, char 61
  Message: ID 'record.e' is not unique

even if the XSD file has this content, where "record.e" is used only once:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xsd:element name="collection" type="collectionType" 
id="collection.e"/>
	<xsd:element name="record" type="xsd:string" id="record.e"/>
	<xsd:complexType name="collectionType" id="collection.ct">
		<xsd:sequence minOccurs="0" maxOccurs="unbounded">
			<xsd:element ref="record"/>
		</xsd:sequence>
	</xsd:complexType>
</xsd:schema>

It turns out that, if the schema gets rearranged to have the "record" 
definition occur *before* the "collection" one, it validates fine.

The error should reside in the fact that the declaration for "collection" 
looks up for the declaration of "collectionType", that invokes 
processElementDeclRef on the "record" reference, that forces the lookup and 
validation of the (yet unseen) "record" entry. When validating the "record" 
entry, its ID is entered in the global ID map; after the validation succeeds, 
the schema information is restored, but the ID map is not cleaned.
So, when the validation process comes to validate the "record" definition, the 
ID seems to have been already used.

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