Re: attribute definitions inside xsd:restriction?

"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 UTC