Re: 'base' in 'restriction'

sandygao@ca.ibm.com writes:

> I think there is an inconsistency in the structure spec
> (http://www.w3.org/TR/xmlschema-1). According to 3.4.2, 'restriction' can
> have a child element 'simpleType', in which case, the 'base' attribute in
> 'restriction' should be omitted. But in appendix A "Schema for Schemas",
> 'base' is always 'required' for 'restriction'.
> 
> My opinion is that 'base' should be 'optional' for 'restriction'.

Note there are _three_ <restriction> elements -- child of
<simpleType>, child of <simpleContent> and child of
<complexContent>/<complexType>.  The first, documented at [1], is the
one which has a forced choice between a 'base' attribute and a
<simpleType> child.

The second and third, which appear in [2] in section 3.4.2, are
different.  They both _require_ a 'base' attribute, but the
<simpleContent> case also _allows_ a <simpleType> child, for the case
where a complexType with simpleContent is restricting another
complexType with simpleContent-- the <restriction>'s base must
reference the complexType, while the <simpleType> child must itself
restrict the base's content type.  Tricky, but when you need it you'll 
understand it.

ht

[1] http://www.w3.org/TR/xmlschema-2/#element-restriction
[2] http://www.w3.org/TR/xmlschema-1/
-- 
  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, 7 May 2001 08:10:48 UTC