"Eliot, Topher" wrote:
> Unfortunately there is no way in a DTD to say "I want one each of the
> following elements, in any order".
> Unfortunately when you discard the ordering constraint, you also
> discard all constraints on how many or few of each sub-element
> you have. Sorry. :-(
My addition to this answer is a fairly pedantic point, but has its place in
ensuring the completeness of the information that we're giving out.
In fact, you can restrict the order and number of occurrences of elements -
the content model:
((a, b+) | (b+, a))
does exactly that. What I suspect Eliot meant to say is that this becomes
difficult to manage as the number of elements increases. In some cases you
might be able to write an application that generate parameter entities from
the SGML "and construct", so that:
<!ELEMENT Goat (a & b+)>
would be replaced with:
<!ENTITY % Goat-content "((a, b+) | (b+, a))">
<!ELEMENT Goat (%Goat-content;)>
These parameter entities could be put out of site, perhaps in another file,
insulating the casual reader of the DTD from the nastiness of these large
constructs. This application wouldn't be dead simple to write, as it would
need to ensure that the content models it constructed remained deterministic
as well as providing a comprehensive choice of order. In fact, for the
content model originally provided, it would be a nightmare.
A more elegant approach would be to use:
a) a schema,
b) an SGML parser, or
c) some other checking mechanism such as Schematron or OmniMark.
Basically, it all comes down to whether you can trade off (or at least
defer) rigid checking of your data.
Marcus Carr email: [log in to unmask]
Allette Systems (Australia) www: http://www.allette.com.au
"Everything should be made as simple as possible, but not simpler."