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

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

From: Edwin Dankert <edankert@cladonia.com>
Date: Fri, 24 Oct 2003 14:41:25 +0100
To: xmlschema-dev@w3.org
Message-ID: <bnba6o$oep$1@sea.gmane.org>

> I have a question for Edwins comment about namespaces. What is the
> significance of the suggestion? I made the schemas with no xs: because of
an
> existing group of schemas that did not have the xs: namespace. I do not
know
> any advantadge nor disadvantadge of doing so.

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. Xerces-J 2.5.0 does complain about
this (and I think this is correct), I don't know why XSV does not complain
about this.

The following however is valid according to Xerces:
<schema xmlns="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://www.w3.org/2001/XMLSchema">
 <element name="A">
  <complexType>
   <all>
    <element ref="B"/>
   </all>
  </complexType>
 </element>
 <element name="B"/>
</schema>

However you probably don't want your elements to be in the XML Schema
namespace.

If you don't want to declare a targetNamespace, use this:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <xs:element name="A">
  <xs:complexType>
   <xs:all>
    <xs:element ref="B"/>
   </xs:all>
  </xs:complexType>
 </xs:element>
 <xs:element name="B"/>
</xs:schema>

If you want to declare a targetnamespace you could use this:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns="test" targetNamespace="test">
 <xs:element name="A">
  <xs:complexType>
   <xs:all>
    <xs:element ref="B"/>
   </xs:all>
  </xs:complexType>
 </xs:element>
 <xs:element name="B"/>
</xs:schema>

Or if you want the schema elements to be in the default namespace:
<schema xmlns="http://www.w3.org/2001/XMLSchema"
  targetNamespace="test" xmlns:test="test">
 <element name="A">
  <complexType>
   <all>
    <element ref="test:B"/>
   </all>
  </complexType>
 </element>
 <element name="B"/>
</schema>

By the way I made a mistake in my previous email, the positiveInteger type
should be referencing a type in the schema namespace so it should look like
this:
xs:positiveInteger

Regards,
Edwin Dankert
Cladonia Ltd.
http://www.cladonia.com/
Received on Friday, 24 October 2003 09:41:52 GMT

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