[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: Re: Alternative approach for key/keyref
Kohsuke KAWAGUCHI wrote: > Path-expression which is used for (c) requires another constraint. That > is, the specified path expression may not match more than one node. > Say every <section> element is uniquely identified by the value of its > <name> element. If a schema allows <name> element to appear more than > once in one section, then there is something wrong, isn't there. Yes, of course. I should have thought about this. (On the other hand, one could argue that a section can have more than one names.) In my previous mail, I have already demonstrated construction of grammars such that an element matches the given path expression if and only if a successful computation assigns a marked named pattern. For a given grammar G and a given pattern p, let G:p be the constructed grammar. First, consider those define elements which have marked named patterns. Replase each terminal symbol a with marked(a), which is a new element name. Then, we replace all <attribute> in G:p with <empty>. Let marked(G:p) be the modified grammar. Third, we create a determinisitc tree automaton that accepts trees containing one and only one marked symbol. The tree automaton is shown below. Final states are s1. s0 ::= not-marked<s0*> s1 ::= marked<s0*> s1 ::= not-marked<s0* s1 s0*> s2 ::= marked <(s0 | s1 | s2)* - s0*)> s2 ::= not-marked <(s0 | s1 | s2)* - (s0* s1 s0*) - s0*)> If we use s0 and s2 as final states, this automaton accepts trees containing no marked symbols or more than one marked symbol. Finally, we compute the intersection of marked(G:p) and this tree automaton. If the result is empty, for any tree t valid against G, one and at most one node in t matches the given pattern p. Cheers, Makoto
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC