1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-13 20:58:16 +03:00

Fix an old bug in xmlSchemaValidateOneElement

Recently I have run into the very same problem Tiberius Duluman did back in
Wed, 13 May 2009 15:56:55 +0300 ([xml] Bug in xmlSchemaValidateOneElement
function). Now I can proof now that his problem is a valid problem. I checked
the latest available version of xmlschemas.c (2.9.0.) and the problem is still
there!
I think I have found a solution to the problem which I'd like proof with you:
My quick solution to the problem is to replace line 27849 in
xmlschemas.c
(v2.9.0.) in function xmlSchemaVDocWalk
    valRoot = xmlDocGetRootElement(vctxt->doc);
with this one:
    valRoot = vctxt->validationRoot ? vctxt->validationRoot : xmlDocGetRootElement(vctxt->doc);
Currently I'm using version 2.7.8. in Windows and this change seems to solve
the problem.
This commit is contained in:
Csaba László 2013-03-18 15:30:00 +08:00 committed by Daniel Veillard
parent cff2546f13
commit 1f6c42cffd

View File

@ -27863,7 +27863,10 @@ xmlSchemaVDocWalk(xmlSchemaValidCtxtPtr vctxt)
const xmlChar *nsName;
/* DOC VAL TODO: Move this to the start function. */
valRoot = xmlDocGetRootElement(vctxt->doc);
if (vctxt->validationRoot != NULL)
valRoot = vctxt->validationRoot;
else
valRoot = xmlDocGetRootElement(vctxt->doc);
if (valRoot == NULL) {
/* VAL TODO: Error code? */
VERROR(1, NULL, "The document has no document element");