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

Re: attribute definitions inside xsd:restriction?

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 16 Apr 2001 22:12:55 +0100
To: "Volkmann, Mark" <Mark.Volkmann@agedwards.com>
Cc: "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>, "'mark.volkmann@home.com'" <mark.volkmann@home.com>
Message-ID: <f5b7l0kwnu0.fsf@cogsci.ed.ac.uk>
"Volkmann, Mark" <Mark.Volkmann@agedwards.com> writes:

<snip/>

> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
>                 elementFormDefault="qualified">
>  <xsd:element name="root">
>   <xsd:complexType>
>    <xsd:simpleContent>
>     <xsd:restriction base="xsd:string">
>      <xsd:attribute name="attr" type="xsd:string" use="required"/>
>     </xsd:restriction>
>    </xsd:simpleContent>
>   </xsd:complexType>
>  </xsd:element>
> </xsd:schema>
> 
> Why should the attribute now be defined inside <xsd:restriction>
> which defines the content?  I think <xsd:attribute> should still be
> a child of <xsd:complexType>.

The above is actually broken -- you must _extend_ string with
attributes.  The following is the correct definition

> <xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
>                 elementFormDefault="qualified">
>  <xsd:element name="root">
>   <xsd:complexType>
>    <xsd:simpleContent>
>     <xsd:extension base="xsd:string">
>      <xsd:attribute name="attr" type="xsd:string" use="required"/>
>     </xsd:extension>
>    </xsd:simpleContent>
>   </xsd:complexType>
>  </xsd:element>
> </xsd:schema>

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
    W3C Fellow 1999--2001, part-time member of W3C Team
   2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
   Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
    URL: http://www.ltg.ed.ac.uk/~ht/
Received on Monday, 16 April 2001 17:12:56 GMT

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