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

attribute definitions inside xsd:restriction?

From: Volkmann, Mark <Mark.Volkmann@agedwards.com>
Date: Mon, 16 Apr 2001 13:44:14 -0500
Message-Id: <0D7BED9608C0D411B3ED00902761F0F098BB2A@hqexchn8.agedwards.com>
To: "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>
Cc: "'mark.volkmann@home.com'" <mark.volkmann@home.com>
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 GMT

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