W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2001

Re: minOccurs and default

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 28 Apr 2001 08:24:35 +0100
To: Tom Welch <twelch@fastlinepub.com>
Cc: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Message-ID: <f5bbsphxz9o.fsf@cogsci.ed.ac.uk>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:20 GMT