attribute definitions inside xsd:restriction?

It seems to me that attributes should always be defined in direct children
of <xsd:complexType>.

For the following XML document

<?xml version="1.0" encoding="UTF-8"?>
<root attr="value"
      xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="simple.xsd">
</root>

this would be a valid schema

<?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:attribute name="attr" type="xsd:string"
use="required"/>
		</xsd:complexType>
	</xsd:element>
</xsd:schema>

After simply allowing text content in <root> like the following

<?xml version="1.0" encoding="UTF-8"?>
<root attr="value"
      xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="complex.xsd">
	content
</root>

the schema changes to this

<?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>.


--
 __  __
/  \/  \        Object Computing, Inc.
\      / ark    (314)589-1617 pager
                (314)993-5533 ext. 034796 A.G.Edwards
  \  / olkmann  (314)579-0066 OCI
   \/           volkmann@inlink.com



***************************************************************************************
WARNING:  All e-mail sent to and from this address will be received or
otherwise recorded by the A.G. Edwards corporate e-mail system and is
subject to archival, monitoring or review by, and/or disclosure to,
someone other than the recipient.
***************************************************************************************

Received on Monday, 16 April 2001 14:51:36 UTC