]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/papers/use_case/stats/parse/parse_xmlsax.c
removed papers that have been moved to the new "papers" repository
[helm.git] / helm / papers / use_case / stats / parse / parse_xmlsax.c
diff --git a/helm/papers/use_case/stats/parse/parse_xmlsax.c b/helm/papers/use_case/stats/parse/parse_xmlsax.c
deleted file mode 100644 (file)
index 334a42e..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-#include <stdio.h>
-#include <sys/time.h>
-#include <libxml/xmlreader.h>
-
-void characters_cb
-(void * ctx, const xmlChar * ch, int len) { return; }
-
-void whitespace_cb
-(void *ctx, const xmlChar *ch, int len) { return; }
-
-void cdata_cb
-(void *ctx, const xmlChar *value, int len) { return; }
-
-void start_element_cb
-(void *ctx, const xmlChar *name, const xmlChar **atts) { return; }
-
-void start_element_ns_cb
-(void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI,
- int nb_namespaces, const xmlChar **namespaces, int nb_attributes,
- int nb_defaulted, const xmlChar **attributes)
-{ return; }
-
-void end_element_ns_cb
-(void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI)
-{ return; }
-
-void error_cb
-(void *ctx, const char *msg, ...) {
-       fprintf(stderr, "Error: %s\n", msg);
-       return;
-}
-
-int
-main(int argc, char *argv[])
-{
-       char buf[BUFSIZ];
-       int res;
-       int done;
-       FILE *xmlfile = stdin;
-       struct timeval timing1, timing2;
-       xmlParserCtxtPtr ctxt;
-       xmlSAXHandler sax = {
-               NULL, /* internalSubsetSAXFunc */
-               NULL, /* isStandaloneSAXFunc */
-               NULL, /* hasInternalSubsetSAXFunc */
-               NULL, /* hasExternalSubsetSAXFunc */
-               NULL, /* resolveEntitySAXFunc */
-               NULL, /* getEntitySAXFunc */
-               NULL, /* entityDeclSAXFunc */
-               NULL, /* notationDeclSAXFunc */
-               NULL, /* attributeDeclSAXFunc */
-               NULL, /* elementDeclSAXFunc */
-               NULL, /* unparsedEntityDeclSAXFunc */
-               NULL, /* setDocumentLocatorSAXFunc */
-               NULL, /* startDocumentSAXFunc */
-               NULL, /* endDocumentSAXFunc */
-               start_element_cb, /* startElementSAXFunc */
-               NULL, /* endElementSAXFunc */
-               NULL, /* referenceSAXFunc */
-               characters_cb, /* charactersSAXFunc */
-               whitespace_cb, /* ignorableWhitespaceSAXFunc */
-               NULL, /* processingInstructionSAXFunc */
-               NULL, /* commentSAXFunc */
-               NULL, /* warningSAXFunc */
-               error_cb, /* errorSAXFunc */
-               NULL, /* fatalErrorSAXFunc */
-               NULL, /* getParameterEntitySAXFunc */
-               cdata_cb, /* cdataBlockSAXFunc */
-               NULL, /* externalSubsetSAXFunc */
-               XML_SAX2_MAGIC, /* initialized */
-               NULL, /* _private */
-               start_element_ns_cb, /* startElementNsSAX2Func */
-               end_element_ns_cb, /* startElementNsSAX2Func */
-               NULL /* xmlStructuredErrorFunc */
-       };
-       ctxt = xmlCreatePushParserCtxt(&sax, NULL, NULL, 0, NULL);
-       if (ctxt == NULL) {
-               fprintf(stderr, "Can't instantiate parser\n");
-               return 1;
-       }
-       gettimeofday(&timing1, NULL);
-       do {
-               size_t len = fread(buf, 1, sizeof(buf), xmlfile);
-               done = len < sizeof(buf);
-               res = xmlParseChunk(ctxt, buf, len, 0);
-               if (res != 0) {
-                       fprintf(stderr, "Parse error\n");
-                       return 1;
-               }
-       } while (!done);
-       gettimeofday(&timing2, NULL);
-       xmlFreeParserCtxt(ctxt);
-       fprintf(stdout, "%d\n",
-                       ((timing2.tv_sec * 1000000 + timing2.tv_usec) -
-                        (timing1.tv_sec * 1000000 + timing1.tv_usec)) / 1000);
-       return 0;
-}
-