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: James Clark <jjc@jclark.com>
Date: Fri, 28 Jun 2002 20:03:59 +0700
To: Priscilla Walmsley <priscilla@walmsley.com>, www-xml-schema-comments@w3.org
cc: mike@ammd.com.au
Message-ID: <32726658.1025294637@[]>

>> 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:attribute name="bar"/>

is short for

    <xs:restriction base="xs:anyType">
      <xs:attribute name="bar"/>

so it seems like a restriction of xs:anyType can define attributes.

Received on Friday, 28 June 2002 09:06:18 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:50:00 UTC