Re: target namespace and namespaces

> In the Namespace spec I can't see any guidance on this question and with 
> the schema spec saying schema location information is optional and at 
> best a hint I don't see any help there either. With the schema location 
> info being a "hint" there seems to be no way to make clear that I would 
> want namespace foo with schema 1 rather than schema 2. So I lean towards 
> this not being necessarily illegal, but a REALLLLLY poor design.

As Xan said, your assumption about <include> was incorrect-- you can 
include items in the same namespace. This leaves you three options as 
near as I can tell:

(1) Create a "driver" or "master" schema-- this does nothing more than 
<include> your two divergent but like-namespaced schemas. Now you are 
back to one schema, which you prefer.

(2) Include more than one schema in the schemaLocation hint

   xsi:schemaLocation="http://foo schema1.xsd
                       http://foo schema2.xsd"

Unfortunately support for this is spotty.

(3) Use some other out of band mechanism. For example in Xerces or MSXML 
you can list multiple schemas to be used for validation. Additionally 
there is RDDL which allows you to identify which schemas can be used to 
validate items coming from a particular namespace (XSV supports this but 
again support for this is not very common) or use NRL (namespace routing 
language) which should allow you to do exactly what you want. Of course 
I haven't seen support for NRL in any XML Schema processor...

So of these... option (1) is the most stable.

Cheers,
Jeff Rafter

Received on Friday, 3 December 2004 16:01:16 UTC