W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2008

Composition by extension in namespaced schema

From: Gavin Kistner <phrogz@mac.com>
Date: Fri, 14 Mar 2008 12:02:24 -0700
To: "xmlschema-dev@w3.org XML Schema Mailing List" <xmlschema-dev@w3.org>
Message-ID: <20DF0D9F-0118-1000-DEFF-B00BF644BE33-Webmail-10021@mac.com>

The appended test case shows a simple schema that fails to validate (using oXygen/Xerces) when the targetNamespace is declared for the file. If I remove the targetNamespace, the file validates and works just fine.

I see that there are 'suggestions' on how to fix this, but I don't know exactly what to do. (Just adding an empty <xs:import> doesn't fix anything. It changes the error to say that the name can't be resolved.)

I need to use a targetNamespace (or is it an xmlns?) in my schema so that I can validate other files without having to add noNamespaceSchemaLocation to those files. Can someone help me understand the core issue here, and (especially) how to modify the file to accomplish the goal?

Thanks! Test case follows:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.foo.com/">
  <xs:complexType name="mammal" />
  <xs:element name="dog">
    <xs:complexType><xs:complexContent>
    	<xs:extension base="mammal" />
    </xs:complexContent></xs:complexType>
  </xs:element>
</xs:schema>

<!--
  SystemID: E:\foo.xsd
  Location: 6:36
  Description: src-resolve.4.1: Error resolving component 'mammal'. It was detected that 'mammal' has no namespace, but components with no target namespace are not referenceable from schema document 'file:/E:/foo.xsd'. If 'mammal' is intended to have a namespace, perhaps a prefix needs to be provided. If it is intended that 'mammal' has no namespace, then an 'import' without a "namespace" attribute should be added to 'file:/E:/foo.xsd'.
  URL: http://www.w3.org/TR/xmlschema-1/#src-resolve
-->
Received on Friday, 14 March 2008 19:02:58 GMT

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