Validating XML instance with a Schema which imports another Schema

I believe this is a bug with Oxygen 9.1, but please correct me if I'm erring in my thoughts or configuration. Here is the scenario: I have a schema which imports a second remote schema. I can validate this schema with its remote schema by configuring a custom validation scenario which declares the remote schema urls, as opposed to using local copies with a SchemaLocation declaration. If I declare local SchemaLocations, this all works and there are no validation errors, so I think I have isolated the problem to an Oxygen 9.1 bug. Now, I wish to perform the next logical step and validate an XML instance of this remote schema. The XML is located here: http://www.hmis.info/schema/2_8/Example_HUD_HMIS_Instance.xml Again, I set up an appropriate custom validation scenario declaring both remote schema (the referred schema) at: http://www.hmis.info/schema/2_8/HUD_HMIS_2_8.xsd and the one it imports at: http://www.hmis.info/schema/2_8/AIRS_3_0_draft5_mod.xsd When I run the Oxygen default validation, I get the following error: "Message:src-resolve: Cannot resolve the name 'airs:tSiteService' to a(n) 'type definition' component." It's complaining about not finding the schema imported by the referred schema. It does find the referred schema aok. This should not happen, as I don't get this error when validating the referred schema, for which Oxygen's validator locates the imported schema when the custom validation scenario is declared. Thanks for either confirming a bug or determining my error. -Eric

Hello, The error is in the schema HUD_HMIS_2_8.xsd located at http://www.hmis.info/schema/2_8/HUD_HMIS_2_8.xsd This schema references the type airs:tSiteService, that is the type tSiteService from the namespace "http://www.hmis.info/schema/2_8/AIRS_3_0_draft5_mod.xsd". The error is that the target namespace of the imported schema http://www.hmis.info/schema/2_8/AIRS_3_0_draft5_mod.xsd is "http://cse.unl.edu/~bkutsch/3_0_draft_d5.xsd" which does not match the namespace used in the import element in HUD_HMIS_2_8.xsd (line 10). That means the type tSiteService defined in AIRS_3_0_draft5_mod.xsd in the namespace "http://cse.unl.edu/~bkutsch/3_0_draft_d5.xsd" cannot be matched with the type reference used on line 828 of HUD_HMIS_2_8.xsd which needs a type tSiteService from the namespace "http://www.hmis.info/schema/2_8/AIRS_3_0_draft5_mod.xsd". You do not need a validation scenario for a simple validation of an XML document against an XML Schema. It does not matter if the schema is local or remote. Oxygen will load it from the specified location. You should use a validation scenario in one of the two situations in which the User Manual recommends it but you are not in these situations: http://www.oxygenxml.com/doc/ug-standalone/validation-scenario.html Regards, Sorin Eric Jahn wrote:
I believe this is a bug with Oxygen 9.1, but please correct me if I'm erring in my thoughts or configuration.
Here is the scenario:
I have a schema which imports a second remote schema. I can validate this schema with its remote schema by configuring a custom validation scenario which declares the remote schema urls, as opposed to using local copies with a SchemaLocation declaration. If I declare local SchemaLocations, this all works and there are no validation errors, so I think I have isolated the problem to an Oxygen 9.1 bug.
Now, I wish to perform the next logical step and validate an XML instance of this remote schema. The XML is located here: http://www.hmis.info/schema/2_8/Example_HUD_HMIS_Instance.xml
Again, I set up an appropriate custom validation scenario declaring both remote schema (the referred schema) at: http://www.hmis.info/schema/2_8/HUD_HMIS_2_8.xsd
and the one it imports at: http://www.hmis.info/schema/2_8/AIRS_3_0_draft5_mod.xsd
When I run the Oxygen default validation, I get the following error:
"Message:src-resolve: Cannot resolve the name 'airs:tSiteService' to a(n) 'type definition' component."
It's complaining about not finding the schema imported by the referred schema. It does find the referred schema aok. This should not happen, as I don't get this error when validating the referred schema, for which Oxygen's validator locates the imported schema when the custom validation scenario is declared.
Thanks for either confirming a bug or determining my error. -Eric

Sorin, thank you for taking a look at this. I fixed the problem you noted by bringing the namespaces into alignment, but validation of http://hmis.info/schema/2_8/Example_HUD_HMIS_2_8_Instance.xml still does not allow the imported schema to be referenced. Response below. On Wed, 2008-04-23 at 13:02 +0300, Sorin Ristache wrote:
The error is that the target namespace of the imported schema http://www.hmis.info/schema/2_8/AIRS_3_0_draft5_mod.xsd is "http://cse.unl.edu/~bkutsch/3_0_draft_d5.xsd" which does not match the namespace used in the import element in HUD_HMIS_2_8.xsd (line 10).
I made the target namespace of the imported doc and the import statement both refer to the same place: http://www.hmis.info/schema/2_8/AIRS_3_0_draft5_mod.xsd But I still get the same "Cannot resolve the name 'airs:tSiteService' to a(n) 'type definition' component." error. Thanks in advance for any further insights. -Eric

Hello, The main schema http://www.hmis.info/schema/2_8/HUD_HMIS_2_8.xsd does not specify the location of the imported schema on line 10. You have to add a schemaLocation attribute to the xsd:import element: <xsd:import namespace="http://www.hmis.info/schema/2_8/AIRS_3_0_draft5_mod.xsd" schemaLocation="http://www.hmis.info/schema/2_8/AIRS_3_0_draft5_mod.xsd"/> Regards, Sorin Eric Jahn wrote:
Sorin, thank you for taking a look at this. I fixed the problem you noted by bringing the namespaces into alignment, but validation of http://hmis.info/schema/2_8/Example_HUD_HMIS_2_8_Instance.xml still does not allow the imported schema to be referenced. Response below.
On Wed, 2008-04-23 at 13:02 +0300, Sorin Ristache wrote:
The error is that the target namespace of the imported schema http://www.hmis.info/schema/2_8/AIRS_3_0_draft5_mod.xsd is "http://cse.unl.edu/~bkutsch/3_0_draft_d5.xsd" which does not match the namespace used in the import element in HUD_HMIS_2_8.xsd (line 10).
I made the target namespace of the imported doc and the import statement both refer to the same place: http://www.hmis.info/schema/2_8/AIRS_3_0_draft5_mod.xsd But I still get the same "Cannot resolve the name 'airs:tSiteService' to a(n) 'type definition' component." error. Thanks in advance for any further insights. -Eric

Sorin, Thanks for the help again. That worked. Quick response below. On Thu, 2008-04-24 at 12:35 +0300, Sorin Ristache wrote: ...
You have to add a schemaLocation attribute to the xsd:import element:
I was afraid you were going to say that. I had thought I could get away with not specifying a schemaLocation, since it's the same place as the imported namespace, so it looked redundant. I also thought this because schemaLocation is optional, and I thought this would be a situation where it could be optional. Instead it looks like the only time you can skip specifying the schemaLocation is when the imported schema resides in the same local directory as the current schema. Oh well, I learned. :) -Eric

Sorin, Thanks for the help again. That worked. Quick response below. On Thu, 2008-04-24 at 12:35 +0300, Sorin Ristache wrote: ...
You have to add a schemaLocation attribute to the xsd:import element:
I was afraid you were going to say that. I had thought I could get away with not specifying a schemaLocation, since it's the same place as the imported namespace, so it looked redundant. I also thought this because schemaLocation is optional, and I thought this would be a situation where it could be optional. Instead it looks like the only time you can skip specifying the schemaLocation is when the imported schema resides in the same local directory as the current schema. Oh well, I learned. :) -Eric
participants (2)
-
Eric Jahn
-
Sorin Ristache