1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

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
This commit is contained in:
Daniel Veillard
2003-03-19 21:02:29 +00:00
parent 798024a110
commit 249d7bbee2
21 changed files with 17540 additions and 39 deletions

View File

@ -1526,15 +1526,22 @@ xmlSchemaValPredefTypeNode(xmlSchemaTypePtr type, const xmlChar *value,
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 @@ xmlSchemaValPredefTypeNode(xmlSchemaTypePtr type, const xmlChar *value,
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);