diff options
author | Nikolai Weibull <now@disu.se> | 2018-11-22 18:09:51 +0100 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2018-11-22 18:14:47 +0100 |
commit | c8e5f9588b986c6e81c9028825aeff8151375d28 (patch) | |
tree | 77d582e6c26ff219ab04e1887958a8c666cfebab /relaxng.c | |
parent | 3776cb4745cecd8f477b45857c9033a908f25cf3 (diff) | |
download | libxml2-c8e5f9588b986c6e81c9028825aeff8151375d28.tar.gz |
Problem with data in interleave in RelaxNG validationv2.9.9-rc1
Reported in https://mail.gnome.org/archives/xml/2018-October/msg00003.html
The issue seems to be that we build groups of what can be matched by
the interleave, but that these groups don’t include data, list,
and value elements, only element and text elements. This patch
extends xmlRelaxNGGetElements so that it can return these elements
for us in xmlRelaxNGComputeInterleaves. Then we make sure to
updatexmlRelaxNGNodeMatchesList as well so that it accepts the correct
types.
Diffstat (limited to 'relaxng.c')
-rw-r--r-- | relaxng.c | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -3979,7 +3979,7 @@ xmlRelaxNGGenerateAttributes(xmlRelaxNGParserCtxtPtr ctxt, * xmlRelaxNGGetElements: * @ctxt: a Relax-NG parser context * @def: the definition definition - * @eora: gather elements (0) or attributes (1) + * @eora: gather elements (0), attributes (1) or elements and text (2) * * Compute the list of top elements a definition can generate * @@ -4005,7 +4005,12 @@ xmlRelaxNGGetElements(xmlRelaxNGParserCtxtPtr ctxt, while (cur != NULL) { if (((eora == 0) && ((cur->type == XML_RELAXNG_ELEMENT) || (cur->type == XML_RELAXNG_TEXT))) || - ((eora == 1) && (cur->type == XML_RELAXNG_ATTRIBUTE))) { + ((eora == 1) && (cur->type == XML_RELAXNG_ATTRIBUTE)) || + ((eora == 2) && ((cur->type == XML_RELAXNG_DATATYPE) || + (cur->type == XML_RELAXNG_ELEMENT) || + (cur->type == XML_RELAXNG_LIST) || + (cur->type == XML_RELAXNG_VALUE)))) { + if (ret == NULL) { max = 10; ret = (xmlRelaxNGDefinePtr *) @@ -4360,7 +4365,7 @@ xmlRelaxNGComputeInterleaves(void *payload, void *data, if (cur->type == XML_RELAXNG_TEXT) is_mixed++; groups[nbgroups]->rule = cur; - groups[nbgroups]->defs = xmlRelaxNGGetElements(ctxt, cur, 0); + groups[nbgroups]->defs = xmlRelaxNGGetElements(ctxt, cur, 2); groups[nbgroups]->attrs = xmlRelaxNGGetElements(ctxt, cur, 1); nbgroups++; cur = cur->next; @@ -9262,7 +9267,10 @@ xmlRelaxNGNodeMatchesList(xmlNodePtr node, xmlRelaxNGDefinePtr * list) return (1); } else if (((node->type == XML_TEXT_NODE) || (node->type == XML_CDATA_SECTION_NODE)) && - (cur->type == XML_RELAXNG_TEXT)) { + ((cur->type == XML_RELAXNG_TEXT) || + (cur->type == XML_RELAXNG_DATATYPE) || + (cur->type == XML_RELAXNG_LIST) || + (cur->type == XML_RELAXNG_VALUE))) { return (1); } cur = list[i++]; |