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

Re: Restriction error

From: C. M. Sperberg-McQueen <cmsmcq@blackmesatech.com>
Date: Sun, 31 Mar 2013 17:25:36 -0600
Cc: "C. M. Sperberg-McQueen" <cmsmcq@blackmesatech.com>, XMLSchema-dev <xmlschema-dev@w3.org>
Message-Id: <B88297E4-28C5-445A-8204-32E7581F25E6@blackmesatech.com>
To: Dave Pawson <dave.pawson@gmail.com>

On Mar 20, 2013, at 8:06 AM, Dave Pawson wrote:

> Note I'm the real newbie here Mike.
> On 20 March 2013 13:53, Michael Kay <mike@saxonica.com> wrote:
>> 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?
> I'm trying to understand this schema, then reduce it.
> Defn:
> <xs:complexType name="SimpleLiteral" mixed="true">
> 		...
> 	</xs:complexType>
> Is that any help?

Yes, it is.  If I understand correctly, you would like to define
a restricted form of the XML vocabulary defined at 
in which elements are not allowed the use of xml:lang, and
you would like to do so without just copying all the schema
documents and modifying them.

If you have access to an XSD 1.1 processor, your best bet
is probably to use xsd:override to change the declaration of
dc:SimpleLiteral.  Otherwise, you will need to use xsd:redefine.
Both of these constructs are intended (sometimes among
other things) for the use case of local restrictions to a 
public schema.

Your redefinition of the dc: namespace can look like this:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  <xs:import namespace="http://www.w3.org/XML/1998/namespace"/>

  <xs:redefine schemaLocation="http://dublincore.org/schemas/xmls/qdc/2008/02/11/dc.xsd">
    <xs:complexType name="SimpleLiteral">
        <xs:documentation xml:lang="en">
          This is a restriction of the default type for all of the DC elements.
          It permits text content only with no xml:lang attribute.  (That is
          its difference from the standard schema at 
          Text is allowed because mixed="true", but sub-elements
          are disallowed because minOccurs="0" and maxOccurs="0" 
          are on the xs:any tag.
          This complexType allows for restriction or extension permitting
          child elements.
      <xs:complexContent mixed="true">
        <xs:restriction base="dc:SimpleLiteral">
          <xs:attribute ref="xml:lang" use="prohibited"/>

I hope this helps.

Michael Sperberg-McQueen

* C. M. Sperberg-McQueen, Black Mesa Technologies LLC
* http://www.blackmesatech.com 
* http://cmsmcq.com/mib                 
* http://balisage.net
Received on Sunday, 31 March 2013 23:26:06 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:16:04 UTC