No subject

roddey at roddey at
Mon May 17 20:24:24 BST 1999

>From: Lars Marius Garshol <larsga at>
>Date: 14 May 1999 09:03:17 +0200
>Subject: Re: Again wit da AND and Repetitions
>* John Cowan
>| IIRC the canonical way of doing (A & B & C) is to transform it into
>| (A | B | C)* and then do a post-check that each of A, B, C appears
>| exactly once.  As opposed to brute-force expansion into a DFA.
>Hmmm. It sounds as if this could be extended to handle {n,m}A as well.
>Just transform it into A+ (or *, depending on n) and do a post-check
>that the number is correct.
>In fact, this solution looks relatively easy to implement.

I don't think it would work in the general sense, because you have lost the
original semantics of the model when you convert it. You would need some way to
'attach' the original semantics onto particular states of the DFA.

For instance, this model:

     ( (A{1..2},B,C,D?,E?) | (A{3..5},B,C,D,E))

If you converted this to:

     ((A+,B,C,D?,E?) | (A+,B,C,D,E))

And you got a content of:


what would you do to go back and check it? The original content model is pretty
unambiguous. If you get one to two As, then D and E are optional. If you get 3
to 5 As, then D and E are not. But in the DFA, that would be pretty ambiguous,
wouldn't it? How would you know which of them was the one that the DFA
considered a match? How would you associate some end state (in the very
interwoven set of states that a DFA would create for this model) with some
auxillary data structure that you would use to go back and post check it?

I admit I might be missing something here and didn't have a lot of time to think
this argument out. I think I could have come up with a much worse scenario, but
this one seems hard enough on the surface of it?

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