W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2003

Stupid question on xs:import

From: Jochen Wiedmann <joe@ispsoft.de>
Date: Fri, 14 Feb 2003 09:07:22 +0100 (CET)
To: xmlschema-dev@w3.org
Message-ID: <1045210042.3e4ca3ba64b3f@webmail.LF.net>


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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:36 GMT