- From: C. M. Sperberg-McQueen <cmsmcq@blackmesatech.com>
- Date: Sun, 31 Mar 2013 17:25:36 -0600
- To: Dave Pawson <dave.pawson@gmail.com>
- Cc: "C. M. Sperberg-McQueen" <cmsmcq@blackmesatech.com>, XMLSchema-dev <xmlschema-dev@w3.org>
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 http://dublincore.org/schemas/xmls/qdc/2008/02/11/dc.xsd 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" targetNamespace="http://purl.org/dc/elements/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/" elementFormDefault="qualified"> <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:annotation> <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 http://dublincore.org/schemas/xmls/qdc/2008/02/11/dc.xsd 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:documentation> </xs:annotation> <xs:complexContent mixed="true"> <xs:restriction base="dc:SimpleLiteral"> <xs:sequence/> <xs:attribute ref="xml:lang" use="prohibited"/> </xs:restriction> </xs:complexContent> </xs:complexType> </xs:redefine> </xs:schema> 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