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 GW...@lmi.org on 2004/05/12 20:51:58 UTC

? Xerces-C vs. Xerces-J (impl diff in regards to ID attr on element)

I have a question identical to that recently posted by Kiran BV:
>> Subject:    Difference in XercesC and XercesJ implementation

Specifically, consider the the following 2 XSD files:
(namespaces omitted for brevity)

*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
*~*~*~*~*
A.xsd
*~*~*~*~*
<xsd:schema id="ABC" targetNamespace>
  <xsd:include schemaLocation="B.xsd">
  <xsd:element name="x" type="xsd:string">
</xsd:schema>
*~*~*~*~*~*~*


*~*~*~*~*
B.xsd
*~*~*~*~*
<xsd:schema id="ABC">
  <xsd:element name="y" type="xsd:string">
</xsd:schema>
*~*~*~*~*~*~*
*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*

Note that B.xsd has the same value in it's ID attribute ABC value is repeated as a id. 
! This duplicate use of the 'ABC' value for the 'id' attr is the crux of the issue.

Many Parsers and Schema validators (Spy, Turbo, SQC, MSV, XSV, .NET XML Framework) do not produce exceptions given this situation. 

Xerces-J DOES NOT either. 
Xerces-C DOES, however, produce an exception: "ID 'ABC' is not unique"  
Xerces-C DOES, however, produce an exception: "ID 'ABC' is not unique"  
Xerces-C DOES, however, produce an exception: "ID 'ABC' is not unique"  

The W3C spec states:
*~*~*~*~*~*~*~*~*~*~*~*
Validity constraint: ID

Values of type ID MUST match the Name production. A name MUST NOT appear more than once in an XML document as a value of this type; i.e., ID values MUST uniquely identify the elements which bear them.
*~*~*~*~*~*~*~*~*~*~*~*

...but, as stated, Xerces-C is the only parser I have found which seems to apply this rigor to a Schema (not just to an instance).
 
Can someone provide insight into whether Xerces-C is 'right' to produce this exception ?

Thanks in advance !
GregW


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