Diff for /XML/testHTML.c between versions 1.14 and 1.15

version 1.14, 2000/08/01 23:42:54 version 1.15, 2000/08/02 16:11:05
Line 403  endElementDebug(void *ctx, const xmlChar Line 403  endElementDebug(void *ctx, const xmlChar
 void  void
 charactersDebug(void *ctx, const xmlChar *ch, int len)  charactersDebug(void *ctx, const xmlChar *ch, int len)
 {  {
       char output[40];
     int i;      int i;
   
     fprintf(stdout, "SAX.characters(");      for (i = 0;(i<len) && (i < 30);i++)
     for (i = 0;(i < len) && (i < 30);i++)          output[i] = ch[i];
         fprintf(stdout, "%c", ch[i]);      output[i] = 0;
     fprintf(stdout, ", %d)\n", len);  
       fprintf(stdout, "SAX.characters(%s, %d)\n", output, len);
 }  }
   
 /**  /**
Line 437  referenceDebug(void *ctx, const xmlChar Line 439  referenceDebug(void *ctx, const xmlChar
 void  void
 ignorableWhitespaceDebug(void *ctx, const xmlChar *ch, int len)  ignorableWhitespaceDebug(void *ctx, const xmlChar *ch, int len)
 {  {
     fprintf(stdout, "SAX.ignorableWhitespace(%.30s, %d)\n",      char output[40];
             (char *) ch, len);      int i;
   
       for (i = 0;(i<len) && (i < 30);i++)
           output[i] = ch[i];
       output[i] = 0;
   
       fprintf(stdout, "SAX.ignorableWhitespace(%s, %d)\n", output, len);
 }  }
   
 /**  /**
Line 571  void parseSAXFile(char *filename) { Line 579  void parseSAXFile(char *filename) {
     /*      /*
      * Empty callbacks for checking       * Empty callbacks for checking
      */       */
     doc = htmlSAXParseFile(filename, NULL, emptySAXHandler, NULL);      if (push) {
     if (doc != NULL) {          FILE *f;
         fprintf(stdout, "htmlSAXParseFile returned non-NULL\n");  
         xmlFreeDoc(doc);          f = fopen(filename, "r");
     }          if (f != NULL) {
               int res, size = 3;
               char chars[4096];
               htmlParserCtxtPtr ctxt;
   
     if (!noout) {              /* if (repeat) */
         /*                  size = 4096;
          * Debug callback              res = fread(chars, 1, 4, f);
          */              if (res > 0) {
         doc = htmlSAXParseFile(filename, NULL, debugSAXHandler, NULL);                  ctxt = htmlCreatePushParserCtxt(emptySAXHandler, NULL,
                               chars, res, filename, 0);
                   while ((res = fread(chars, 1, size, f)) > 0) {
                       htmlParseChunk(ctxt, chars, res, 0);
                   }
                   htmlParseChunk(ctxt, chars, 0, 1);
                   doc = ctxt->myDoc;
                   htmlFreeParserCtxt(ctxt);
               }
               if (doc != NULL) {
                   fprintf(stdout, "htmlSAXParseFile returned non-NULL\n");
                   xmlFreeDoc(doc);
               }
               fclose(f);
           }
           if (!noout) {
               f = fopen(filename, "r");
               if (f != NULL) {
                   int res, size = 3;
                   char chars[4096];
                   htmlParserCtxtPtr ctxt;
   
                   /* if (repeat) */
                       size = 4096;
                   res = fread(chars, 1, 4, f);
                   if (res > 0) {
                       ctxt = htmlCreatePushParserCtxt(debugSAXHandler, NULL,
                                   chars, res, filename, 0);
                       while ((res = fread(chars, 1, size, f)) > 0) {
                           htmlParseChunk(ctxt, chars, res, 0);
                       }
                       htmlParseChunk(ctxt, chars, 0, 1);
                       doc = ctxt->myDoc;
                       htmlFreeParserCtxt(ctxt);
                   }
                   if (doc != NULL) {
                       fprintf(stdout, "htmlSAXParseFile returned non-NULL\n");
                       xmlFreeDoc(doc);
                   }
                   fclose(f);
               }
           }
       } else {    
           doc = htmlSAXParseFile(filename, NULL, emptySAXHandler, NULL);
         if (doc != NULL) {          if (doc != NULL) {
             fprintf(stdout, "htmlSAXParseFile returned non-NULL\n");              fprintf(stdout, "htmlSAXParseFile returned non-NULL\n");
             xmlFreeDoc(doc);              xmlFreeDoc(doc);
         }          }
   
           if (!noout) {
               /*
                * Debug callback
                */
               doc = htmlSAXParseFile(filename, NULL, debugSAXHandler, NULL);
               if (doc != NULL) {
                   fprintf(stdout, "htmlSAXParseFile returned non-NULL\n");
                   xmlFreeDoc(doc);
               }
           }
     }      }
 }  }
   
Line 617  void parseAndPrintFile(char *filename) { Line 682  void parseAndPrintFile(char *filename) {
                 doc = ctxt->myDoc;                  doc = ctxt->myDoc;
                 htmlFreeParserCtxt(ctxt);                  htmlFreeParserCtxt(ctxt);
             }              }
               fclose(f);
         }          }
     } else {          } else {    
         doc = htmlParseFile(filename, NULL);          doc = htmlParseFile(filename, NULL);

Removed from v.1.14  
changed lines
  Added in v.1.15


Webmaster