attempt to cope with ID/IDREF(S) declared both in the DTD and in the
* valid.c xmlschemastypes.c: attempt to cope with ID/IDREF(S)
declared both in the DTD and in the Schemas <grin/>
* relaxng.c: more debug, added a big optimization for <mixed>
* test/relaxng/testsuite.xml: augmented the testsuite
* test/relaxng/ result/relaxng: added the RelaxNG spec and a
DocBook example to the regression tests
Daniel
diff --git a/xmlschemastypes.c b/xmlschemastypes.c
index 254e88d..0e1c7cc 100644
--- a/xmlschemastypes.c
+++ b/xmlschemastypes.c
@@ -1526,15 +1526,22 @@
if ((ret == 0) && (node != NULL) &&
(node->type == XML_ATTRIBUTE_NODE)) {
xmlAttrPtr attr = (xmlAttrPtr) node;
- xmlChar *strip;
- strip = xmlSchemaStrip(value);
- if (strip != NULL) {
- xmlAddRef(NULL, node->doc, strip, attr);
- xmlFree(strip);
- } else
- xmlAddRef(NULL, node->doc, value, attr);
- attr->atype = XML_ATTRIBUTE_IDREF;
+ /*
+ * NOTE: the REFness might have already be declared in the DTD
+ */
+ if ((attr->atype != XML_ATTRIBUTE_IDREF) &&
+ (attr->atype != XML_ATTRIBUTE_IDREFS)) {
+ xmlChar *strip;
+
+ strip = xmlSchemaStrip(value);
+ if (strip != NULL) {
+ xmlAddRef(NULL, node->doc, strip, attr);
+ xmlFree(strip);
+ } else
+ xmlAddRef(NULL, node->doc, value, attr);
+ attr->atype = XML_ATTRIBUTE_IDREF;
+ }
}
return(ret);
} else if (type == xmlSchemaTypeIdrefsDef) {
@@ -1559,19 +1566,24 @@
if ((ret == 0) && (node != NULL) &&
(node->type == XML_ATTRIBUTE_NODE)) {
xmlAttrPtr attr = (xmlAttrPtr) node;
- xmlIDPtr res;
- xmlChar *strip;
+ /*
+ * NOTE: the IDness might have already be declared in the DTD
+ */
+ if (attr->atype != XML_ATTRIBUTE_ID) {
+ xmlIDPtr res;
+ xmlChar *strip;
- strip = xmlSchemaStrip(value);
- if (strip != NULL) {
- res = xmlAddID(NULL, node->doc, strip, attr);
- xmlFree(strip);
- } else
- res = xmlAddID(NULL, node->doc, value, attr);
- if (res == NULL) {
- ret = 2;
- } else {
- attr->atype = XML_ATTRIBUTE_ID;
+ strip = xmlSchemaStrip(value);
+ if (strip != NULL) {
+ res = xmlAddID(NULL, node->doc, strip, attr);
+ xmlFree(strip);
+ } else
+ res = xmlAddID(NULL, node->doc, value, attr);
+ if (res == NULL) {
+ ret = 2;
+ } else {
+ attr->atype = XML_ATTRIBUTE_ID;
+ }
}
}
return(ret);