There's a restriction described in the tutorial (end of section 6) and
implemented in my sample implementation, but not yet described in the
spec (5.2 is a placeholder), that makes this illegal.
Say that a pattern p "distinguishes strings" if:
- p matches t1 and
- p matches t2 and
- t1 and t2 differ only in their character children
(ie p contains <string> or <data> patterns; containing <anyString> alone
does not make p distinguish strings).
Say that a pattern p "allows children" if there exists a tree t such
that p matches t and t has non-empty children (and not all whitespace).
Then the restriction is that
<group>p1 p2</group>
is not allowed if
- p1 distinguishes strings, and
- p2 allows children
or vice-versa. Similarly for interleave and for any pattern that
implicitly groups. So for
<oneOrMore>p</oneOrMore>
it's an error if p distinguishes strings.
Murata Makoto wrote:
>
> Consider a patter as below:
>
> <interleave><anyString/><string>true</string></interleave>
>
> In my understanding, this matches "true", "0t0r0u0e", "1111t8rtu2342e".
>
> Another example:
>
> <interleave><data type="xsd:integer"/><string>13</string></interleave>
>
> This matches "1234", since it is an interleaving of "24" and "13", where
> "24" is an integer.
>
> I think that this makes implementation very difficult or even impossible.
> Furthermore, I see no values in allowing such patterns.
>
> Cheers,
>
> Makoto