Commit 8074b881 authored by Jan Pokorný's avatar Jan Pokorný Committed by Nick Wellnhofer

Fix unability to validate ambiguously constructed interleave for RelaxNG

Previously, test/relaxng/ambig_name-class.xml would fail to validate
for a simple reason -- interleave within "open-name-class" context
is supposed to be fine with whatever else is pending the consumption,
since effectively, it's unrelated from a higher parsing perspective.
Signed-off-by: default avatarJan Pokorný <jpokorny@redhat.com>
parent 81958b6e
......@@ -9476,7 +9476,17 @@ xmlRelaxNGValidateInterleave(xmlRelaxNGValidCtxtPtr ctxt,
xmlRelaxNGFreeValidState(ctxt, oldstate);
oldstate = ctxt->state;
ctxt->state = NULL;
if (cur != NULL) {
if (cur != NULL
/* there's a nasty violation of context-free unambiguities,
since in open-name-class context, interleave in the
production shall finish without caring about anything
else that is OK to follow in that case -- it would
otherwise get marked as "extra content" and would
hence fail the validation, hence this perhaps
dirty attempt to rectify such a situation */
&& (define->parent->type != XML_RELAXNG_DEF
|| !xmlStrEqual(define->parent->name,
(const xmlChar *) "open-name-class"))) {
VALID_ERR2(XML_RELAXNG_ERR_INTEREXTRA, cur->name);
ret = -1;
ctxt->state = oldstate;
......
./test/relaxng/ambig_name-class.rng validates
tutorA.rng
\ No newline at end of file
<grammar xmlns="http://relaxng.org/ns/structure/1.0" >
<start>
<element name="foo">
<attribute>
<choice>
<name>alpha</name>
<name>bravo</name>
</choice>
<choice>
<value>none</value>
<value>all</value>
</choice>
</attribute>
</element>
</start>
</grammar>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment