Again wit da AND and Repetitions / Singletons in a DTD

Lars Marius Garshol larsga at
Sat May 15 23:33:50 BST 1999

* Terje Norderhaug
| For example, take the content model (A & B & C) expressing that we
| require the three elements in any order. Here is the XML equivalent
| content model:
| (A,((B,C)|(C,B))) | (B,((A,C)|(C,A))) | (C,((A,B)|(B,A)))

The number of states here more or less follows n factorial, leaving
the solution useless after 10 elements in a list or so.
| [...] This proves that supporting the AND connector isn't much
| harder than implementing the current connectors.

Given infinitely long paper tapes, yes. :)
| Simply make the parser keep track of which elements in the AND list
| have not yet been parsed. For each element encountered, remove its
| item from the list. [...]

This is essentially the same solution that John Cowan mentioned
earlier, and that I mused might be extended to cover the {m,n}
modifier as well.

However, I now see a potential problem with this in the presence of
ambiguous content models. I've taken a different line with this
compared to many of the others here, since I see no reason not to
allow them (they cause no harm in XML). Furthermore, the recommendation
only has a non-binding requirement that they be rejected. (I will warn
about them, but that's another matter.)

The problem is that if you generate a non-deterministic automaton from
the weaker content model (A | B | ...)* and convert it to a
deterministic one your deterministic states will be combinations of
the non-d ones, which (I think) may mean that in some cases you won't
know whether to enable the special & actions or not, since you don't
know whether you're inside the & group or outside it.

Does anyone know whether this really is a problem or not?

--Lars M.

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as: and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list