1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-26 10:03:34 +03:00

Fix unability to RelaxNG-validate grammar with choice-based name class

Previously, test/relaxng/ambig_name-class2.xml would fail to validate
against test/relaxng/ambig_name-class2.rng:

> test/relaxng/ambig_name-class2.rng:4:
>   element attribute: Relax-NG parser error :
>       Found anyName attribute without oneOrMore ancestor
> Relax-NG schema test/relaxng/ambig_name-class2.rng failed to compile

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
This commit is contained in:
Jan Pokorný 2019-08-09 15:09:22 +02:00 committed by Nick Wellnhofer
parent 8074b88179
commit ea695ac0d6
5 changed files with 7 additions and 1 deletions

View File

@ -6395,7 +6395,10 @@ xmlRelaxNGCheckRules(xmlRelaxNGParserCtxtPtr ctxt,
NULL, NULL);
}
if ((!(flags & XML_RELAXNG_IN_ONEORMORE))
&& (cur->name == NULL)) {
&& cur->name == NULL
/* following is checking alternative name class readiness
in case it went the "choice" route */
&& cur->nameClass == NULL) {
if (cur->ns == NULL) {
xmlRngPErr(ctxt, cur->node, XML_RNGP_ANYNAME_ATTR_ANCESTOR,
"Found anyName attribute without oneOrMore ancestor\n",

View File

@ -0,0 +1 @@
./test/relaxng/ambig_name-class2.rng validates

View File

View File

@ -0,0 +1 @@
ambig_name-class.xml

View File

@ -0,0 +1 @@
<foo alpha="all"/>