Von: "luis" <luis mail mis cycu edu tw>
Datum: Mon, 1 Aug 2005 09:35:08 +0800

I try to validate a XML message by using  several schemas, 
but in the xmlschemas.c I got a problem, the function
would ignored some element validated, thus I added some code(see below) 
xmlSchemaValidateElem() to solve this proble.

vctxt->inode->decl = xmlSchemaGetElem(vctxt->schema,
      if (vctxt->inode->decl == NULL) {
       return (-1);

Is there anything wrong? How should I do?
Any suggestion is appreciated.

Although I like chasing such incomplete reports :-), since I'm on
holiday, others might get annoyed and ignore your post, or even worse:
potentially know how to solve your problem, but don't understand
your question.
We need somehow to know what revision of the source file you mentioned
you are using, so a CVS diff with the "-c" option (context diff) would
be good.
Since the code is new (Libxml2 2.6.20) and didn't change in CVS HEAD
and I'm responsible for this piece of code, it was easy to find though.

In xmlschemas.c, revision 1.162, line 22901 we have:

        * Get the declaration of the validation root.
        vctxt->inode->decl = xmlSchemaGetElem(vctxt->schema,
        if (vctxt->inode->decl == NULL) {
            ret = XML_SCHEMAV_CVC_ELT_1;
            VERROR(ret, NULL,
                "No matching global declaration available "
                "for the validation root");
            goto exit;

This will be executed for the validation root of your instance, i.e.
only the first element on which the validation started. If you change
the result returned by this function to -1 here, then this should
fire an internal error in xmlSchemaVDocWalk() and the validation will
stop. xmlSchemaValidateDoc() should return -1 at the end.
It seems that this will likely not solve your problem.

Please provide a standalone example of your issue: the schemata and
instances you used (the more minimal the better), and the steps to
reproduce; this could be either with xmllint or your code (minimal).
Best would be to file a bug, as explained at



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