|
next
|
Subject: Re: Cyclic import in schema Author: (Deleted User) Date: 25 Mar 2003 12:01 PM
|
Hi Vinayak,
At 15.23 24/03/2003 -0500, you wrote:
>From: "Vinayak Sapre"
>
>I think the issue is partially fixed. If the schemalocation is a URL it
>still gives error.
>
>This is what I tried
>1. I made sure that the two files, one.xsd and two.xsd, attached to my
>original email validate correctly.
>2. I copied these files on docroot of my local webserver.
>3. Changed schemaLocation to http://localhost/one.xsd and
>http://localhost/two.xsd.
>
>The two.xsd validates okay. But One.xsd says there errors in two.xsd.
I tried doing as you say, but I am able to validate both of them; I
followed the following steps:
- installed Apache 2.0.44 on the local machine (Windows XP), listening on
port 8080
- copied the original one.xsd and two.xsd to the folder mapped to the web root
- opened Stylus, and loaded both file using the URLs
http://localhost:8080/one.xsd and http://localhost:8080/two.xsd
- validation succeeds for both files, even without changing the xsd:import
statement (it uses a relative path, so the other schema can be found)
- I tried changing the server port to 80, and opening
http://localhost/one.xsd and http://localhost/two.xsd, but validation still
succeeds
- I edited the files to use the full URLs in their import statements
(instead of just the relative name), and they still succeeds
So, I guess that you are opening one.xsd inside Stylus using the file
system path (e.g. "C:\webroot\one.xsd"), while using the web server URLs
inside the xsd:import statement; in this case, the Xerces validator cannot
detect the cyclic import, because what it sees is c:\webroot\one.xsd ->
http://localhost/two.xsd -> http://localhost/one.xsd
If this is the case, you should open the documents inside Stylus using the
web server URLs
Hope this helps,
Alberto
|
next
|
Subject: Re: Cyclic import in schema Author: (Deleted User) Date: 26 Mar 2003 04:01 AM
|
At 17.41 25/03/2003 -0500, you wrote:
>From: "Vinayak Sapre"
>
>Thanks. I worked the way you suggested.
>
>I am curious that IBM schema quality checker validated it succussfully.
>sqc -requireEachDocumentValid c:\webroot\one.xsd c:\webroot\two.xsd
>
>Basically the same file is accessed by two urls Filesystem URL and http
>URL. Xerces may be treating those as two files. But they have identicle
>definitions. Does it matter?
It does matter to Xerces. I guess this is related to one of the assumption=
it has: one namespace must be defined in exactly one schema document (for
instance, if you split the two.xsd file into two separate schemas and use
{xsd:import namespace="two" schemaLocation="two1.xsd"/} {xsd:import
namespace="two" schemaLocation="two2.xsd"/} inside one.xsd, only the= first
xsd:import statement is taken into consideration)
[For the record, this assumption is based on the following sentence from
the specs: "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."]
So, if Xerces sees that two.xsd is trying to import the same one.xsd that
has already being loaded (but not yet processed), it will go on processing=
just the definition it needs in that moment; if it sees that you try to
import another URL for the same namespace, it will silently ignore it.
>Also how do I get error only for one xsd.
It depends on the contents of the schemas; definitions are validated only
when requested, so you could have a different behaviour by making a global=
definition local or vice versa.
Alberto
|
|
|
|