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

Re: Invalid per cvc-complex-type.1.3: undeclared attribute {None}:use

From: Jeni Tennison <jeni@jenitennison.com>
Date: Sat, 25 Oct 2003 22:10:53 +0100
Message-ID: <4841233831.20031025221053@jenitennison.com>
To: "Edwin Dankert" <edankert@cladonia.com>
Cc: xmlschema-dev@w3.org

Hi Edwin,

> If you don't use a targetNamespace, none of your Elements or
> Attributes should be in a namespace, however at the moment your
> Elements and Attributes are defined in the XMLSchema namespace.

I absolutely agree with your recommendation that you use a prefix for
the XML Schema namespace when dealing with a schema with no target
namespace.

Just a very small correction: the problem is not that the elements and
attributes you declare get put in the XML Schema namespace; if your
schema doesn't have a target namespace then the elements and
attributes are put in no namespace. Rather, the problem is that you
can't then *refer* to the elements and attributes you declare (or the
types you define) because the (unprefixed) qualified names that you
need to use to refer to them will be resolved using the default
namespace declaration, and hence all refer to
elements/attributes/types in the XML Schema namespace.

So, for example, the following is absolutely fine, because it doesn't
contain any references; both the <A> and <B> elements are placed in no
namespace:

<schema xmlns="http://www.w3.org/2001/XMLSchema">
  <element name="A">
    <complexType>
      <all>
        <element name="B" />
      </all>
    </complexType>
  </element>
</schema>

The following is problematic because the reference ref="B" will be
resolved based on the default XML Schema namespace, and no element
called <B> from the XML Schema namespace is present in the schema:

<schema xmlns="http://www.w3.org/2001/XMLSchema">
  <element name="A">
    <complexType>
      <all>
        <element ref="B"/>
      </all>
    </complexType>
  </element>
  <element name="B"/>
</schema>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Saturday, 25 October 2003 17:16:10 GMT

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