[xml] bug in valid.c

Date view Thread view Subject view Author view

From: Gary Pennington (Gary.Pennington@uk.sun.com)
Date: Wed Feb 07 2001 - 12:38:19 EST


Hi,

I've found what I think is a bug in the xmlValidateOneAttribute
function. When checking for validity the routine does not detect that an
error has been flagged for a duplicate ID or non existent ref without
this patch. Thus invalid documents, although reported as such by the
error and warning functions, are not reported as invalid by the
xmlValidateDocument (etc... ) routines.

Patch is :-

*** ../ORIG/libxml2-2.2.11/valid.c Fri Jan 5 06:39:29 2001
--- valid.c Wed Feb 7 17:31:11 2001
***************
*** 2831,2842 ****

      /* Validity Constraint: ID uniqueness */
      if (attrDecl->atype == XML_ATTRIBUTE_ID) {
! xmlAddID(ctxt, doc, value, attr);
      }

      if ((attrDecl->atype == XML_ATTRIBUTE_IDREF) ||
        (attrDecl->atype == XML_ATTRIBUTE_IDREFS)) {
! xmlAddRef(ctxt, doc, value, attr);
      }

      /* Validity Constraint: Notation Attributes */
--- 2831,2844 ----

      /* Validity Constraint: ID uniqueness */
      if (attrDecl->atype == XML_ATTRIBUTE_ID) {
! if (xmlAddID(ctxt, doc, value, attr) == NULL)
! ret = 0;
      }

      if ((attrDecl->atype == XML_ATTRIBUTE_IDREF) ||
        (attrDecl->atype == XML_ATTRIBUTE_IDREFS)) {
! if (xmlAddRef(ctxt, doc, value, attr) == NULL)
! ret = 0;
      }

      /* Validity Constraint: Notation Attributes */

Yours,

Gary

----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Feb 07 2001 - 14:46:04 EST