W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > April to June 2002

RE: Feature request - anonymous simplecontent type definition within complex type definition

From: Priscilla Walmsley <priscilla@walmsley.com>
Date: Fri, 28 Jun 2002 09:21:56 -0400
To: "'James Clark'" <jjc@jclark.com>, <www-xml-schema-comments@w3.org>
Cc: <mike@ammd.com.au>
Message-ID: <000001c21ea6$c758df90$339afea9@WALMSLEYPH>

Yes, sorry - I read the message too quickly and overlooked the fact that
you were restricting anyType rather than a simple type definition.

I think this _should_ work because it is the equivalent of deriving a
simple content type from an emptiable mixed content type.  There is a
contradiction in the rec regarding this (see R-68 [1]), but the WG has
agreed to allow this. 

Nice solution!

Priscilla

[1] http://www.w3.org/2001/05/xmlschema-rec-comments#pfiSimpleContent

-----------------------------------------------------
Priscilla Walmsley             priscilla@walmsley.com
Author, Definitive XML Schema     (Prentice Hall PTR)
----------------------------------------------------- 

> -----Original Message-----
> From: James Clark [mailto:jjc@jclark.com] 
> Sent: Friday, June 28, 2002 9:04 AM
> To: Priscilla Walmsley; www-xml-schema-comments@w3.org
> Cc: mike@ammd.com.au
> Subject: Re: Feature request - anonymous simplecontent type 
> definition within complex type definition
> 
> 
> 
> >> Maybe I'm missing something, but can't you avoid this by doing
> > something
> >> like this
> >
> >>  <xs:element name="foo">
> >>    <xs:complexType>
> >>     <xs:simpleContent>
> >>       <xs:restriction base="xs:anyType">
> >>         <xs:simpleType>
> >>           <xs:restriction base="xs:string">
> >>             <xs:maxLength value="8"/>
> >>           </xs:restriction>
> >>         </xs:simpleType>
> >>         <xs:attribute name="bar"/>
> >>       </xs:restriction>
> >>     </xs:simpleContent>
> >>   </xs:complexType>
> >> </xs:element>
> >
> > Unfortunately that won't work because adding attributes is 
> considered an
> > extension, not a restriction, and you can't do both in one step.
> 
> I don't understand why you say it won't work. It works in all the 
> implementations I've tried (SQC, XSV, MSXML).  Can you point 
> me to where in 
> Part 1 it is disallowed? Syntactically it's legal: a <restriction> in 
> <simpleContent> does allow <attribute>: in the S4S, 
> simpleRestrictionType 
> refs attrDecls.  Also
> 
> <xs:complexType>
>   <xs:attribute name="bar"/>
> </xs:complexType>
> 
> is short for
> 
> <xs:complexType>
>   <xs:complexContent>
>     <xs:restriction base="xs:anyType">
>       <xs:attribute name="bar"/>
>     </xs:restriction>
>   </xs:complexContent>
> </xs:complexType>
> 
> so it seems like a restriction of xs:anyType can define attributes.
> 
> James 
> 
Received on Friday, 28 June 2002 09:24:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:13:01 GMT