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: <noah_mendelsohn@us.ibm.com>
Date: Fri, 28 Jun 2002 09:51:01 -0400
To: James Clark <jjc@jclark.com>
Cc: mike@ammd.com.au, priscilla@walmsley.com, www-xml-schema-comments@w3.org
Message-ID: <OF139665BF.869C48A8-ON85256BE6.004AF619@lotus.com>

Maybe I'm reading this too quickly, but I believe what's going on here IS 
restriction.  The complex type has as its base anyType, so anything is 
indeed a restriction of that.  The simple type defined is in turn a 
restriction of String.  So, the attribute is not an extension of string. 
The overall complex type, attribute and all, is a restriction of anyType. 
It so happens to have simple content, so the whole thing could be misread 
as an extension of that simple content.  It's not, I think.

------------------------------------------------------------------
Noah Mendelsohn                              Voice: 1-617-693-4036
IBM Corporation                                Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142
------------------------------------------------------------------







James Clark <jjc@jclark.com>
Sent by: www-xml-schema-comments-request@w3.org
06/28/02 09:03 AM

 
        To:     Priscilla Walmsley <priscilla@walmsley.com>, 
www-xml-schema-comments@w3.org
        cc:     mike@ammd.com.au, (bcc: Noah Mendelsohn/Cambridge/IBM)
        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 10:09:54 GMT

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