Re: Schema being imported multiple times

Hi,

Nguyen, Thang wrote:


> 
> I'm using MSXML4.dll (Visual Basic 6) and schema validation.  When I create
> Schema1.xml and validate it with VB, it's fine but when I create Schema2.xml
> and validate, it comes up with an error   "  The '{urn:Common}
> RevisionNumber' element has already been declared"
> (but the validation is successful withing XML Spy)
> 
> This is because Common.xsd is being pulled into the SchemaCache twice (once
> from Schema2.xsd and once from Schema1.xsd).
> 
> is there a way to work around this error?


I don't know how to workaround it with MSXML4, but it's a bug for a 
validator to give this error even though it is considered as a bad 
practice for an application to include multiple schema imports for a 
same namespace.

The rec says it in plain English:

http://www.w3.org/TR/xmlschema-1/#src-import

"NOTE: The above is carefully worded so that multiple <import>ing 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 <import>ing the same schema document more 
than once to forestall the necessity of establishing identity component 
by component. Given that the schemaLocation [attribute] is only a hint, 
it is open to applications to ignore all but the first <import> for a 
given namespace, regardless of the ·actual value· of schemaLocation, but 
such a strategy risks missing useful information when new 
schemaLocations are offered."


Hope this helps.


Eric


> 
> Thanks
> 
> 
> 
> 
> 
> 



-- 
Rendez-vous ą Paris pour une visite guidee de la nebuleuse XML.
                                           http://dyomedea.com/formation/
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
------------------------------------------------------------------------

Received on Wednesday, 10 October 2001 11:03:10 UTC