=?ISO-8859-1?Q?Re:_[XML]validate_a_XML_message_by_using__several_schemas?=



Hi,

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

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


vctxt->inode->decl = xmlSchemaGetElem(vctxt->schema,
vctxt->inode->localName,
vctxt->inode->nsName);
      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,
            vctxt->inode->localName,
            vctxt->inode->nsName);
        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
http://www.xmlsoft.org/bugs.html.

Cheers,

Kasimier





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