XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Anonymous 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.


Applicationschema3.xsd


DocumentEnvelope.xsd
Containing Schema

Documentschema2.xsd


Documentschema1.xsd

Postnext
Ivan PedruzziSubject: Problem with multiple imports into a schema
Author: Ivan Pedruzzi
Date: 11 Jun 2002 07:41 AM
Reading carefully the XML Schema Specs

http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-import

The last note states

"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."

Looks like Xerces is more conservative here

Postnext
Anonymous 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? ...

Postnext
Ivan PedruzziSubject: Problem with multiple imports into a schema
Author: Ivan Pedruzzi
Date: 12 Jun 2002 01:46 AM
In the example posted you are trying to import the same namespace three times

-- envelope.xsd --
{xsd:import schemaLocation="schema1.xsd" namespace="www.mynamespace.com"}

{xsd:import schemaLocation="schema2.xsd" namespace="www.mynamespace.com"}

{xsd:import schemaLocation="schema3.xsd" namespace="www.mynamespace.com"}

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.

Ivan

Postnext
Anonymous 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.

Postnext
Patrick CrossSubject: 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.

Posttop
(Deleted User) 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".

Hope this helps,
Alberto

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.