XML: How to require either or both of two child elements, but prevent both missing?

Gregor Hagedorn G.Hagedorn at BBA.DE
Mon Mar 3 13:50:53 CET 2003


thanks everybody for the responses and help. I am only just back from
a trip so I could not respond earlier.

I agree that the:


approach is working (albeit it makes the schema a bit difficult to
read). The suggestions to put a minOccurs on the choice compositor
containing optional elements is not working: having no element is
fine for schema (at least with validator built into xmlspy). Also it
could lead to an A-A sequence.

James: Yes, having <Parent><A/><A/></Parent> is undesirable, it
should really be a choice of two alternative expressions of a fact.

Examples are where a definition may either be inline directly given
free-form text or a URI pointing to another place, or both, but not
neither. Two inline definition elements would be difficult to
interpret (whats the difference between the two? Semantics of using
one or multiple?...) In this example multiple URIs would in fact be
allowable, but in other examples not).

Pavel: You are right about additional validation in xslt. It is
needed elsewhere already, but work on that has to come later.

Thanks again

Gregor Hagedorn (G.Hagedorn at bba.de)
Institute for Plant Virology, Microbiology, and Biosafety
Federal Research Center for Agriculture and Forestry (BBA)
Koenigin-Luise-Str. 19          Tel: +49-30-8304-2220
14195 Berlin, Germany           Fax: +49-30-8304-2203

Often wrong but never in doubt!

More information about the tdwg-content mailing list