At 2003-12-04 23:23 +0000, Neil Evans wrote:
>I'm new to XML, and I'm a bit confused as to the use of the 'choice' element
>within a schema. I understand that it details a list of child elements, and
>will allow one of those child elements to be used, and no more than one.
>But, is it valid to add a 'MinOccurs=0' attribute to each child element,
>therefore allowing none of the child elements to be used?
Yes. By doing so the designer has allowed that no children will
successfully satisfy the content model constraints. Personally I don't
ever do this because it is ambiguous ... when I want no children allowed
for a choice I typically make the choice optional and each of the children
mandatory, as that (to me) more accurately reflects the semantics I want: I
usually want the choice optional, but when the user does choose to include
the choice I don't want them to then be able to choose nothing. What would
this mean to a processing application?
This question has been around since the early days of SGML because one can
do this with DTDs.
>I have seen this
>in a schema that has been defined for my latest project at work, and I'm not
>sure if this is valid.
It is not incorrect, but whether it accurately reflects the desired
information modeling choice being presented as a constraint on the
structure of an instance can only be answered by the people who know your
I hope this helps.
Next public European delivery: 3-day XSLT/2-day XSL-FO 2004-01-??
Instructor-led on-site corporate, government & user group training
for XSLT and XSL-FO world-wide: please contact us for the details
G. Ken Holman mailto:[log in to unmask]
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/l/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6 Definitive XSLT and XPath
ISBN 0-13-140374-5 Definitive XSL-FO
ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
ISBN 1-894049-11-X Practical Formatting Using XSL-FO
Member of the XML Guild of Practitioners: http://XMLGuild.info
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/l/bc