mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-01-12 09:17:37 +03:00
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: Jan Pokorný <jpokorny@redhat.com>
This commit is contained in:
parent
81958b6e94
commit
8074b88179
12
relaxng.c
12
relaxng.c
@ -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;
|
||||
|
1
result/relaxng/ambig_name-class_err
Normal file
1
result/relaxng/ambig_name-class_err
Normal file
@ -0,0 +1 @@
|
||||
./test/relaxng/ambig_name-class.rng validates
|
0
result/relaxng/ambig_name-class_valid
Normal file
0
result/relaxng/ambig_name-class_valid
Normal file
1
test/relaxng/ambig_name-class.rng
Symbolic link
1
test/relaxng/ambig_name-class.rng
Symbolic link
@ -0,0 +1 @@
|
||||
tutorA.rng
|
16
test/relaxng/ambig_name-class.xml
Normal file
16
test/relaxng/ambig_name-class.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<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>
|
Loading…
Reference in New Issue
Block a user