added integer and fixed one of the IDREFS regression tests pbm updated
* xmlschemastypes.c: added integer and fixed one of the
IDREFS regression tests pbm
* result/relaxng/docbook_0.err: updated
Daniel
diff --git a/ChangeLog b/ChangeLog
index 49e15a3..03823a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Mar 20 17:22:00 CET 2003 Daniel Veillard <daniel@veillard.com>
+
+ * xmlschemastypes.c: added integer and fixed one of the
+ IDREFS regression tests pbm
+ * result/relaxng/docbook_0.err: updated
+
Wed Mar 19 21:58:47 CET 2003 Daniel Veillard <daniel@veillard.com>
* valid.c xmlschemastypes.c: attempt to cope with ID/IDREF(S)
diff --git a/result/relaxng/docbook_0.err b/result/relaxng/docbook_0.err
index a934dec..86c4912 100644
--- a/result/relaxng/docbook_0.err
+++ b/result/relaxng/docbook_0.err
@@ -1,4 +1,3 @@
./test/relaxng/docbook_0.xml:1864: error: Entity 'copy' not defined
<sgmltag>&copy;</sgmltag> — copyright sign (©)
^
-Unimplemented block at xmlschemastypes.c:1636
diff --git a/xmlschemastypes.c b/xmlschemastypes.c
index 0e1c7cc..e626e61 100644
--- a/xmlschemastypes.c
+++ b/xmlschemastypes.c
@@ -1343,6 +1343,42 @@
}
}
return(0);
+ } else if (type == xmlSchemaTypeIntegerDef) {
+ const xmlChar *cur = value;
+ unsigned long base = 0;
+ int total = 0;
+ int sign = 0;
+ if (cur == NULL)
+ return(1);
+ if (*cur == '-') {
+ sign = 1;
+ cur++;
+ } else if (*cur == '+')
+ cur++;
+ while (*cur == '0') {
+ total++;
+ cur++;
+ }
+ while ((*cur >= '0') && (*cur <= '9')) {
+ base = base * 10 + (*cur - '0');
+ total++;
+ cur++;
+ }
+ if (*cur != 0)
+ return(1);
+ if ((sign == 1) && (total == 0))
+ return(1);
+ if (val != NULL) {
+ v = xmlSchemaNewValue(XML_SCHEMAS_INTEGER);
+ if (v != NULL) {
+ v->value.decimal.base = base;
+ v->value.decimal.sign = sign;
+ v->value.decimal.frac = 0;
+ v->value.decimal.total = total;
+ *val = v;
+ }
+ }
+ return(0);
} else if ((type == xmlSchemaTypeFloatDef) ||
(type == xmlSchemaTypeDoubleDef)) {
const xmlChar *cur = value;
@@ -1526,22 +1562,15 @@
if ((ret == 0) && (node != NULL) &&
(node->type == XML_ATTRIBUTE_NODE)) {
xmlAttrPtr attr = (xmlAttrPtr) node;
+ xmlChar *strip;
- /*
- * 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;
- }
+ 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) {