Re: [xml] Schema validity failure for valid document



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.

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].

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.

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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