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

Re: SimpleContent question

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 01 Mar 2001 19:40:19 +0000
To: Jeff Lowery <jlowery@scenicsoft.com>
Cc: "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>
Message-ID: <f5bvgptb7mk.fsf@cogsci.ed.ac.uk>
Jeff Lowery <jlowery@scenicsoft.com> writes:

> The spec states that simpleContent can restrict an existing simple type, but
> within the context of defining a complex type I can't see how it would be
> used. Since a simple type can't have an attribute, and a complex type with
> simple content would be expected to have at least one, how can restricting a
> simple type be of any use in that case? One would just use an anonymous
> simple type and restrict that.

<xs:complexType name="length">
  <xs:extension base="xs:integer">
   <xs:attribute name="units"/>

<xs:complexType name="posLength">
  <xs:restriction base="length">
   <xs:minExclusive value="0"/>

Does this help?  Both posLength and length allow a 'units' attribute,
but where length allows an integer as content, posLength requires a
positive one.

  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 Thursday, 1 March 2001 14:40:26 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:49:54 UTC