Diff for /XML/valid.c between versions 1.27 and 1.28

version 1.27, 1999/09/05 21:37:56 version 1.28, 1999/09/13 12:28:56
Line 1601  xmlCreateRefTable(void) { Line 1601  xmlCreateRefTable(void) {
 xmlRefPtr   xmlRefPtr 
 xmlAddRef(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const CHAR *value,  xmlAddRef(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const CHAR *value,
          xmlAttrPtr attr) {           xmlAttrPtr attr) {
     xmlRefPtr ret, cur;      xmlRefPtr ret;
     xmlRefTablePtr table;      xmlRefTablePtr table;
     int i;  
   
     if (doc == NULL) {      if (doc == NULL) {
         fprintf(stderr, "xmlAddRefDecl: doc == NULL\n");          fprintf(stderr, "xmlAddRefDecl: doc == NULL\n");
Line 1630  xmlAddRef(xmlValidCtxtPtr ctxt, xmlDocPt Line 1629  xmlAddRef(xmlValidCtxtPtr ctxt, xmlDocPt
     }      }
   
     /*      /*
      * Valrefity Check:  
      * Search the DTD for previous declarations of the ATTLIST  
      */  
     for (i = 0;i < table->nb_refs;i++) {  
         cur = table->table[i];  
         if (!xmlStrcmp(cur->value, value)) {  
             /*  
              * The ref is already defined in this Dtd.  
              */  
             VERROR(ctxt->userData, "Ref %s already defined\n", value);  
             return(NULL);  
         }  
     }  
   
     /*  
      * Grow the table, if needed.       * Grow the table, if needed.
      */       */
     if (table->nb_refs >= table->max_refs) {      if (table->nb_refs >= table->max_refs) {
Line 2403  xmlValidateOneAttribute(xmlValidCtxtPtr Line 2387  xmlValidateOneAttribute(xmlValidCtxtPtr
         xmlAddID(ctxt, doc, value, attr);          xmlAddID(ctxt, doc, value, attr);
     }      }
   
       if (attrDecl->type == XML_ATTRIBUTE_IDREF) {
           xmlAddRef(ctxt, doc, value, attr);
       }
   
     /* Validity Constraint: Notation Attributes */      /* Validity Constraint: Notation Attributes */
     if (attrDecl->type == XML_ATTRIBUTE_NOTATION) {      if (attrDecl->type == XML_ATTRIBUTE_NOTATION) {
         xmlEnumerationPtr tree = attrDecl->tree;          xmlEnumerationPtr tree = attrDecl->tree;
Line 2877  xmlValidateElement(xmlValidCtxtPtr ctxt, Line 2865  xmlValidateElement(xmlValidCtxtPtr ctxt,
 }  }
   
 /**  /**
    * xmlValidateDocumentFinal:
    * @ctxt:  the validation context
    * @doc:  a document instance
    *
    * Does the final step for the document validation once all the
    * incremental validation steps have been completed
    *
    * basically it does the following checks described by the XML Rec
    * 
    *
    * returns 1 if valid or 0 otherwise
    */
   
   int
   xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, xmlDocPtr doc) {
       int ret = 1, i;
       xmlRefTablePtr table;
       xmlAttrPtr id;
   
       if (doc == NULL) {
           fprintf(stderr, "xmlValidateDocumentFinal: doc == NULL\n");
           return(0);
       }
   
       /*
        * Get the refs table
        */
       table = doc->refs;
       if (table != NULL) {
           for (i = 0; i < table->nb_refs; i++) {
               id = xmlGetID(doc, table->table[i]->value);
               if (id == NULL) {
                   VERROR(ctxt->userData, 
                          "IDREF attribute %s reference an unknown ID '%s'\n",
                          table->table[i]->attr->name, table->table[i]->value);
                   ret = 0;
               }
           }
       }
       return(ret);
   }
   
   /**
  * xmlValidateDtd:   * xmlValidateDtd:
  * @ctxt:  the validation context   * @ctxt:  the validation context
  * @doc:  a document instance   * @doc:  a document instance
Line 2916  xmlValidateDocument(xmlValidCtxtPtr ctxt Line 2947  xmlValidateDocument(xmlValidCtxtPtr ctxt
     if (!xmlValidateRoot(ctxt, doc)) return(0);      if (!xmlValidateRoot(ctxt, doc)) return(0);
   
     ret = xmlValidateElement(ctxt, doc, doc->root);      ret = xmlValidateElement(ctxt, doc, doc->root);
     return(1);      ret &= xmlValidateDocumentFinal(ctxt, doc);
       return(ret);
 }  }
   

Removed from v.1.27  
changed lines
  Added in v.1.28


Webmaster