You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Mike Spreitzer <ms...@us.ibm.com> on 2002/04/19 23:38:08 UTC

Problem with derivation

I'm having trouble with some derivation by restriction; I suspect it is 
due to a bug in Xerces.  Both Xerces 2.0.0 and 2.0.1 seem to give error 
messages that I think are wrong (although I'll admit I'm not the greatest 
expert on this stuff).  I have a simple example program, XML instance, and 
XML schema that demonstrate the problem.  Here is the output of the 
program:

java parse ftest2.xml
Parsing ftest2.xml...
XML Parse problem at file:///C:/dir/foo.xsd:37:32 - 
rcase-NSRecurseCheckCardinality.2: There is not a complete functional 
mapping between the particles.
XML Parse problem at file:///C:/dir/foo.xsd:37:32 - 
derivation-ok-restriction.5.3: Error for type 'redef'.  The particle of 
the type is not a valid restriction of the particle of the base.

I think my XML instance should validate wrt my XML schema.  Actually, the 
problem is pretty clearly in the schema constraint checking, since the 
schema declaration about which Xerces complains is not even referenced 
from the XML instance.  I note that in the XML Schema Part 1 (Structures) 
document (the W3C Recommendation of 2 May 2001), NSRecurseCheckCardinality does not require a "complete functional mapping between the particles". I 
*do* think NSRecurseCheckCardinality is the right case to be looking at: the sequence in my base particle *is* 
"pointless" (as defined in the "Schema Component Constraint: Particle Valid (Restriction)"), so we are considering the case of an "all" particle restricting an 
"any".  I do not think my schema violates clause 2 of that case, which is 
about range restriction: the base particle's range is 0--unbounded, and 
the restricted particle's range is 2--2.  Also, I do not even know what 
clause of the spec is being cited by the string "derivation-ok-restriction.5.3".

The simple test program just instantiates 
org.apache.xerces.parsers.DOMParser; turns on the features 
"http://xml.org/sax/features/validation", 
"http://apache.org/xml/features/validation/schema", and 
"http://apache.org/xml/features/validation/schema-full-checking"; and 
parses (with an error handler that just prints stuff like you see above).

At the end of this message I attach the XML instance and two schema files 
(I get the same results from both schema files).

Thanks,
Mike