Re: Stupid question on xs:import

Hi Jochen,

> However, my schema validator (xerces) complains
>
>     Cannot find the declaration of element 'object'.
>
> Can anyone explain what I am doing wrong?

I think that what's happening is that Xerces is only loading the
schemas that it needs when it needs them. When it comes across an
<object> element, it looks for a schema for elements with no
namespace, and it doesn't find one since you don't have a
xsi:noNamespaceSchemaLocation attribute.

If you add an xsi:noNamespaceSchemaLocation="object.xsd" to your
instance document then it stops giving that error. Of course it gives
others because the db2:table attribute isn't declared and anyway the
<object> element can't have any attribute aside from the id attribute,
but those are different problems. (I'd recommend creating an "adaptor
schema" with no target namespace that redefines the objectType type so
that it can hold attributes from your namespace.)

I *think* that Xerces is probably wrong to error here. It's clearly
gathering schema components lazily, which is fine, but I think that it
should probably look through all the referenced schemas to work out
which namespaces it has schemas for rather than raising an error;
otherwise you get discrepancies between validators that lazily
construct the schemas and those that gather them whole.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Friday, 14 February 2003 04:45:05 UTC