Stupid question on xs:import

Hi,

I apologize in advance for a stupid question, but even after
careful reading of several example and an attempt to read the
spec, I am still stuck.

I have an external schema, which is not created by me and doesn't
use namespaces. For my own purposes, I would like to extend the
schema. To distinguish my own elements and attributes, I would
like to use a namespace. The original schema and a sample document
look like this:

  object.xsd:
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:complexType name="objectType">
        <xs:sequence>
          <xs:element name="name" type="xs:string"/>
        </xs:sequence>
        <xs:attribute name="id" type="xs:string"/>
      </xs:complexType>
      <xs:element name="object" type="objectType"/>
    </xs:schema>

  object.xml:
    <object xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation='object.xsd'
	id="test">
      <name>foo bar</name>
    </object>

Now, here's my schema (I have of course omitted a lot):

  objectdb2.xsd:
    <xs:schema
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:db2="http://dcx.com/namespaces/sein/dbtk/db2"
      targetNamespace="http://dcx.com/namespaces/sein/dbtk/db2">
      <xs:import namespace="" schemaLocation="object.xsd"/>
    </xs:schema>

Now I would expect the following to be a valid instance:

  objectdb2.xml:
    <object xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:db2="http://dcx.com/namespaces/sein/dbtk/db2"
        xsi:schemaLocation='http://dcx.com/namespaces/sein/dbtk/db2
                            objectdb2.xsd'
	id="test" db2:table="x">
      <name>foo bar</name>
    </object>

However, my schema validator (xerces) complains

    Cannot find the declaration of element 'object'.

Can anyone explain what I am doing wrong?


Kind regards,

Jochen

Received on Friday, 14 February 2003 03:08:42 UTC