Subject:Problem with multiple imports into a schema Author:Anonymous Date:11 Jun 2002 02:20 AM
Hi,
I've found that the schema validator seems to be only working with the first imported (sub)schema. With the attached files, if you alter the order of the imported schemas the validator will complain about a different pair of the elements in the choice block.
"Given that the schemaLocation [attribute] is only a hint, it is open to applications to ignore all but the first for a given namespace, regardless of the ·actual value· of schemaLocation, but such a strategy risks missing useful information when new schemaLocations are offered."
Subject:Problem with multiple imports into a schema Author:Anonymous Date:11 Jun 2002 06:42 PM
The problem isn't that it can ignore the subsequent namespace declarations. The standard only says that the import namespace must be different from that of the schema they're being imported into - so no issues there.
The problem appears to be that Xerces considers peer element definitions using imported types, from all but the first import, to be in error.
I can get around this problem in the example schemas by including two of the subschemas in the other and just importing that one into the envelope schema. But, of course, I shouldn't have to do that. Plus, it pretty badly mangles the interrelationships between schemas. For what I'm really working on this is unacceptable.
Any ideas? Bug report to Apache? ...
The schemaLocation attribute is considered only an hint (it is optional) therefore the three imports look exactly the same to the validator.
In this case Xerces decide to ignore all except the first, the specs allow to do so.
Let's hope that the next Xerces release will be smarter.
Subject:Problem with multiple imports into a schema Author:Anonymous Date:12 Jun 2002 06:25 PM
Thanks,
I looked at the spec in a little more detail and it does state that the parser isn't under any obligation to look up any of the schemas that are imported. It does imply though that the reason why a parser wouldn't look up the hinted at schema is because it could get to it through some other means (e.g. it had its own internal copy). So here's hoping that Xerces does get a bit smarter.
Subject:Problem with multiple imports into a schema Author:Patrick Cross Date:22 Feb 2008 02:31 PM
I seem to be getting this same error with Stylus studio 2007 (build 735f). I am having a hard time believing it is 6 years later and Xerces is still broken. The schema i am using does validate fine in XMLSpy. Can i get an update as to what is causing the error and how to resolve it for Stylus Studio>
PS - the schema is not one i have defined. It is an external schema and i am trying to create XML documents so i cannot just change the schema.
Subject:Problem with multiple imports into a schema Author:(Deleted User) Date:29 Feb 2008 02:23 AM
Hi Patrick,
unfortunately the schema specs allows this behaviour, so the community doesn't feel it as a bug in the Xerces validator. To be precise, the schema specs goes further by saying "multiple importing of the same schema document will not constitute a violation of clause 2 of Schema Properties Correct (§3.15.6), but applications are allowed, indeed encouraged, to avoid importing the same schema document more than once to forestall the necessity of establishing identity component by component".