Enabled IDC parsing and validation. Added xmlSchemaCopyValue to the API;
* xmlschemas.c: Enabled IDC parsing and validation.
* xmlschemastypes.c include/libxml/xmlschemastypes.h:
Added xmlSchemaCopyValue to the API; this was done due to
validation of default attributes against IDCs: since IDC keys
consume the precomputed value, one needs a copy.
* pattern.c: Enabled IDC support; this is currently done
via calling xmlPatterncompile with a flag arg of 1.
diff --git a/xmlschemas.c b/xmlschemas.c
index cd49a1e..8314053 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -54,11 +54,11 @@
#define ELEM_INFO_ENABLED 1
-/* #define IDC_ENABLED 1 */
+#define IDC_ENABLED 1
-/* #define IDC_VALUE_SUPPORT 1 */
+#define IDC_VALUE_SUPPORT 1
-/* #define IDC_XPATH_SUPPORT 1 */
+#define IDC_XPATH_SUPPORT 1
/* #define DEBUG_IDC 1 */
@@ -5984,10 +5984,10 @@
}
if (isField)
selector->xpathComp = (void *) xmlPatterncompile(selector->xpath,
- NULL, 0, nsArray);
+ NULL, 1, nsArray);
else
selector->xpathComp = (void *) xmlPatterncompile(selector->xpath,
- NULL, 0, nsArray);
+ NULL, 1, nsArray);
if (nsArray != NULL)
xmlFree((xmlChar **) nsArray);
@@ -19876,6 +19876,7 @@
}
/*
* Init the attribute info.
+ * TODO: Hmm, maby a bit oversized this all.
*/
ctxt->attrInfo->flags = 0;
ctxt->attrInfo->decl = (xmlSchemaTypePtr) attrDecl;
@@ -19895,13 +19896,14 @@
ctxt->attrInfo->value = NULL;
}
if (ret > 0) {
+ /*
+ * IDCs will consume the precomputed default value,
+ * so we need to clone it somehow.
+ */
ctxt->attrInfo->value = xmlSchemaCopyValue(attrDecl->defVal);
/* TODO: error on NULL return. */
}
- /*
- * TODO URGENT: This will consume the precomputed default value,
- * so we need to clone it somehow.
- */
+
if (xmlSchemaXPathProcessHistory(ctxt, ctxt->depth +1) == -1)
goto fatal_exit;
}