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

Re: Restriction error

From: Michael Kay <mike@saxonica.com>
Date: Wed, 20 Mar 2013 13:53:56 +0000
Message-ID: <5149BF74.3000809@saxonica.com>
To: xmlschema-dev@w3.org
A complex-type-with-simple-content is generally defined by extension: 
think of it as first defining the simple content of the element, then 
extending it to allow attributes.

You can define a c-t-with-s-c as a restriction of another c-t-with-s-c, 
but that doesn't seem to be what you are doing here; the suggestion from 
the error message is that dc:SimpleLiteral is a simple type, not a 
c-t-with-s-c.

Difficult to correct this without knowing what you are trying to 
achieve. Why are you saying xml:lang is prohibited? Does your new type 
allow any attributes, and if so, which? What is the definition of 
dc:SimpleLiteral?

Michael Kay
Saxonica

On 20/03/2013 13:03, Dave Pawson wrote:

>      <xs:restriction base="dc:SimpleLiteral">
>          <xs:simpleType> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>            <xs:restriction base="dcmitype:DCMIType"/>
>          </xs:simpleType>
>          <xs:attribute ref="xml:lang" use="prohibited"/>
>      </xs:restriction>
>     </xs:simpleContent>
>    </xs:complexType>
>
>
>
> The report is A complex type with simple content {defined at line 196
> 	of file:/t...} cannot be derived by restriction from a simple
> 	type
>
> I've read that ten times and it makes little sense.
>
Well, to understand it you have to know

(a) what is a complex type with simple content? It's what you are trying 
to define when you use <xs:simpleContent>; that is, the type of an 
element such as <a currency="USD">22.50</a> where the content is 
"simple" (here, a number) and there are one or more attributes allowed.

(b) what does it mean to derive by restriction? It means to define one 
type as having a value space that is a subset of the value space of some 
base type

(c) what is a simple type? It's something defined using xs:simpleType, 
in this case dc:SimpleLiteral.

Does that help your understanding?

Michael Kay
>
>
>
Received on Wednesday, 20 March 2013 13:54:27 GMT

This archive was generated by hypermail 2.3.1 : Wednesday, 20 March 2013 13:54:27 GMT