Taco Hoekwater <[EMAIL PROTECTED]> writes:

> > ><!ELEMENT one ( (a, b?, c?) | (a, c?, b?) |
> > >                 (b?, a, c?) | (c?, a, b?) |
> > >                 (b?, c?, a) | (c?, b?, a) )
> 
> Berend, this doesn't actually work. The XML parser cannot find the correct
> branch so it considers the definition to be ambiguous when it finds alternative
> 2, 5 or 6 (because it has already seen 1,4 and 3 resp.)

It might be interesting to know that it does actually work :-) Xerces
finds this totally acceptable. As this is the only XML validating
parser I have, I'm interested in what other parser do. Or does anyone
know that xerces does look ahead?

According to the specs it is ambiguous, but it works :-)


In case people want to test it:

===========================
<?xml version="1.0"?>
<!DOCTYPE root SYSTEM "test.dtd">
<root>
<one> <a>...</a> <b>...</b> <c>...</c> </one>
<one> <a>...</a> <c>...</c> <b>...</b> </one>
<one> <b>...</b> <c>...</c> <a>...</a> </one>
<one> <a>...</a> </one>
</root>
===========================


===========================
<!ELEMENT root (one*)>

<!ELEMENT one ( (a, b?, c?) | (a, c?, b?) |
                (b?, a, c?) | (c?, a, b?) |
                (b?, c?, a) | (c?, b?, a) )>

<!ELEMENT a (#PCDATA)>
<!ELEMENT b (#PCDATA)>
<!ELEMENT c (#PCDATA)>
===========================

-- 
Groetjes,

Berend. (-:

Reply via email to