Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

595792 fixing a RelaxNG bug introduced in 2.7.4

* relaxng.c: refs definitions added from inported schemas should not
  be processed as refs from the main schemas
* test/relaxng/595792* result/relaxng/595792*: add the test to the
  regression suite
  • Loading branch information...
commit aa422d9254f373141428bf0879f08af7ad15f3bf 1 parent 4dd115c
Veillard Daniel veillard authored
9 relaxng.c
View
@@ -149,6 +149,7 @@ typedef enum {
#define IS_PROCESSED (1 << 5)
#define IS_COMPILABLE (1 << 6)
#define IS_NOT_COMPILABLE (1 << 7)
+#define IS_EXTERNAL_REF (1 << 8)
struct _xmlRelaxNGDefine {
xmlRelaxNGType type; /* the type of definition */
@@ -4662,6 +4663,8 @@ xmlRelaxNGParseImportRef(void *payload, void *data, xmlChar *name) {
xmlRelaxNGDefinePtr def = (xmlRelaxNGDefinePtr) payload;
int tmp;
+ def->dflags |= IS_EXTERNAL_REF;
+
tmp = xmlHashAddEntry(ctxt->grammar->refs, name, def);
if (tmp < 0) {
xmlRelaxNGDefinePtr prev;
@@ -5668,6 +5671,12 @@ xmlRelaxNGCheckReference(xmlRelaxNGDefinePtr ref,
xmlRelaxNGGrammarPtr grammar;
xmlRelaxNGDefinePtr def, cur;
+ /*
+ * Those rules don't apply to imported ref from xmlRelaxNGParseImportRef
+ */
+ if (ref->dflags & IS_EXTERNAL_REF)
+ return;
+
grammar = ctxt->grammar;
if (grammar == NULL) {
xmlRngPErr(ctxt, ref->node, XML_ERR_INTERNAL_ERROR,
1  result/relaxng/595792-ext_err
View
@@ -0,0 +1 @@
+./test/relaxng/595792-ext.rng validates
0  result/relaxng/595792-ext_valid
View
No changes.
0  result/relaxng/595792_0
View
No changes.
1  result/relaxng/595792_0.err
View
@@ -0,0 +1 @@
+./test/relaxng/595792_0.xml validates
1  result/relaxng/595792_err
View
@@ -0,0 +1 @@
+./test/relaxng/595792.rng validates
0  result/relaxng/595792_valid
View
No changes.
11 test/relaxng/595792-ext.rng
View
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <element name="t">
+ <ref name="tcont"/>
+ </element>
+ </start>
+ <define name="tcont">
+ <text/>
+ </define>
+</grammar>
8 test/relaxng/595792.rng
View
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <element name="root">
+ <externalRef href="595792-ext.rng"/>
+ </element>
+ </start>
+</grammar>
4 test/relaxng/595792_0.xml
View
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<root>
+ <t>foo</t>
+</root>
Please sign in to comment.
Something went wrong with that request. Please try again.