- valid.c: new patch from Gary Pennington
Daniel
diff --git a/ChangeLog b/ChangeLog
index 9ed0abc..7c4bc2d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Mon Feb 26 12:48:35 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
+
+ * valid.c: new patch from Gary Pennington
+
Mon Feb 26 09:30:23 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* doc/xml.html: applied patch from Ankh
diff --git a/valid.c b/valid.c
index cbfa5e0..f29db62 100644
--- a/valid.c
+++ b/valid.c
@@ -1686,11 +1686,21 @@
* Refs *
* *
************************************************************************/
-typedef struct xmlRemove_t
+typedef struct xmlRemoveMemo_t
{
xmlListPtr l;
xmlAttrPtr ap;
-} xmlRemove;
+} xmlRemoveMemo;
+
+typedef xmlRemoveMemo *xmlRemoveMemoPtr;
+
+typedef struct xmlValidateMemo_t
+{
+ xmlValidCtxtPtr ctxt;
+ const xmlChar *name;
+} xmlValidateMemo;
+
+typedef xmlValidateMemo *xmlValidateMemoPtr;
/**
* xmlCreateRefTable:
@@ -1744,8 +1754,8 @@
xmlWalkRemoveRef(const void *data, const void *user)
{
xmlAttrPtr attr0 = ((xmlRefPtr)data)->attr;
- xmlAttrPtr attr1 = ((xmlRemove *)user)->ap;
- xmlListPtr ref_list = ((xmlRemove *)user)->l;
+ xmlAttrPtr attr1 = ((xmlRemoveMemoPtr)user)->ap;
+ xmlListPtr ref_list = ((xmlRemoveMemoPtr)user)->l;
if (attr0 == attr1) { /* Matched: remove and terminate walk */
xmlListRemoveFirst(ref_list, (void *)data);
@@ -1895,7 +1905,7 @@
xmlListPtr ref_list;
xmlRefTablePtr table;
xmlChar *ID;
- xmlRemove target;
+ xmlRemoveMemo target;
if (doc == NULL) return(-1);
if (attr == NULL) return(-1);
@@ -3667,9 +3677,15 @@
return(ret);
}
-
+/**
+ * xmlValidateRef:
+ * @ref: A reference to be validated
+ * @ctxt: Validation context
+ * @name: Name of ID we are searching for
+ *
+ */
void
-xmlValidateCheckRefCallback(xmlRefPtr ref, xmlValidCtxtPtr ctxt,
+xmlValidateRef(xmlRefPtr ref, xmlValidCtxtPtr ctxt,
const xmlChar *name) {
xmlAttrPtr id;
xmlAttrPtr attr;
@@ -3718,6 +3734,42 @@
}
/**
+ * xmlWalkValidateList:
+ * @data: Contents of current link
+ * @user: Value supplied by the user
+ *
+ * Return 0 to abort the walk or 1 to continue
+ */
+static int
+xmlWalkValidateList(const void *data, const void *user)
+{
+ xmlValidateMemoPtr memo = (xmlValidateMemoPtr)user;
+ xmlValidateRef((xmlRefPtr)data, memo->ctxt, memo->name);
+ return 1;
+}
+
+/**
+ * xmlValidateCheckRefCallback:
+ * @ref_list: List of references
+ * @ctxt: Validation context
+ * @name: Name of ID we are searching for
+ *
+ */
+static void
+xmlValidateCheckRefCallback(xmlListPtr ref_list, xmlValidCtxtPtr ctxt,
+ const xmlChar *name) {
+ xmlValidateMemo memo;
+
+ if (ref_list == NULL)
+ return;
+ memo.ctxt = ctxt;
+ memo.name = name;
+
+ xmlListWalk(ref_list, xmlWalkValidateList, &memo);
+
+}
+
+/**
* xmlValidateDocumentFinal:
* @ctxt: the validation context
* @doc: a document instance