1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-19 14:50:07 +03:00

fix schema validation in combination with xsi:nil

Based on Thomas Gamper <icicle@cg.tuwien.ac.at> findings and
initial patch

There is no point doing a regexp validation of further
content if there actually is no further content because the
element is nilled.
This commit is contained in:
Daniel Veillard 2013-02-28 19:02:32 +08:00
parent 19d785b5c7
commit c100e69c4b

View File

@ -26063,6 +26063,20 @@ xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt)
"AUTOMATON create on '%s'\n", inode->localName);
#endif
}
/*
* Do not check further content if the node has been nilled
*/
if (INODE_NILLED(inode)) {
ret = 0;
#ifdef DEBUG_AUTOMATA
xmlGenericError(xmlGenericErrorContext,
"AUTOMATON succeeded on nilled '%s'\n",
inode->localName);
#endif
goto skip_nilled;
}
/*
* Get hold of the still expected content, since a further
* call to xmlRegExecPushString() will loose this information.
@ -26100,6 +26114,9 @@ xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt)
}
}
skip_nilled:
if (inode->typeDef->contentType == XML_SCHEMA_CONTENT_ELEMENTS)
goto end_elem;