Re: minOccurs and default

Tom Welch <twelch@fastlinepub.com> writes:

> Is the following element guaranteed to create one and only one node when the
> node is not explicitly defined in the document using this schema?
> 
> <element name="one" type="decimal" minOccurs="0" maxOccurs="3" default="1"/>

Element defaults are not like attribute defaults, in part because of
occurrence range issues.

The above construct will _never_ create an element node -- it will
simply fill in the value 1 for any _empty_ element in the
schema-processed infoset, e.g.

<one>234</one>
<one/>
<one>432</one>

will have the same PSVI as

<one>234</one>
<one>1</one>
<one>432</one>

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 Saturday, 28 April 2001 03:24:33 UTC