Re: [xml] Schema validity failure for valid document



Hi,

Daniel Veillard wrote:
On Mon, Jan 10, 2005 at 12:53:09PM +0100, Kasimier Buchcik wrote:

from the xmlregexp.h header soon. But special code to improve the Schemas

error reports would still be needed, Kasimier does this fit your need ?

Cool!
A namespace aware version would be needed as well.
Proposal:
 xmlRegExecErrInfo2(xmlRegExecCtxtPtr exec,
   const xmlChar **string,
   const xmlChar **string2, <-- the namespace name
   int *nbval,
   xmlChar **values,
   xmlChar **values2) <-- the array of namespace names

In the case of the XML Schema engine, @string and @string2 would be
already known.


  Well, there is only one string in the regexp automata.
xmlRegExecPushString2() coalesce pairs. I'm not sure duplicating
the API is a good thing, either the info function expand coalesced
sctrings or not, but having 2 function calls sounds a bit messy to me.

OK, so I'll format the local name and the namespace on the schema side.
The problem I saw was that the regex engine formats the local name
and the namespace name, to squeeze it into one string using
xmlAutomataNewTransition2; extracting those values on the schema side
would mean that the format is no longer encapsulated in the regex
code. But if this is OK with you, I'll do it.


Occurence:

Content model: (a, b*, c)
input: <a/><d/>
would xmlRegExecErrInfo return "b" for values[0], or
rather "c", since the automaton should have passed the
b* ?


  it will return that 2 values are possible one will be b one will be c
I can't tell which one will be [0] and which one will be [1].

Good, I was not aware that it took this already into account.

This leads to the question if/how to report occurence information;
at least if the element is mandatory or not.

Content model: (a, b+, c)
input: <a/><b/><d/>
At the point of the error prone input of "d" it seems cruicial to
report that the allowed input at this point can be
an optional "b" or a "c". Don't know if this info can be provided by the
regex engine.


  it is you get both strings on output. Well you should, I think you
misunderstood the API, values is a pointer to an array of string pointers.
And the testerr show how to use it:

static void testerr(xmlRegExecCtxtPtr exec) {
    const xmlChar *string;
    const xmlChar *values[5];
    int nb = 5;
    int terminal;
    xmlRegExecErrInfo(exec, &string, &nb, &values[0], &terminal);
}

  terminal is a new parameter, indicating if the state is a terminal state.

This sounds fine :-) I'll try to integrate it.

Regards,

Kasimier




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]