/xmlbench/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/xmlbench/trunk

« back to all changes in this revision

Viewing changes to parse/libxml-sax.c

  • Committer: Suren A. Chilingaryan
  • Date: 2009-02-16 09:27:17 UTC
  • Revision ID: csa@dside.dyndns.org-20090216092717-wipyvaaw2srxhgns
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
#include <sys/time.h>
 
3
#include <libxml/xmlmemory.h>
 
4
#include <libxml/parser.h>
 
5
 
 
6
#include "tools.h"
 
7
 
 
8
#if LIBXML_VERSION > 20600
 
9
#define _SAX2_BENCHMARK
 
10
#endif
 
11
 
 
12
void startElement_(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, const xmlChar **atts) {
 
13
    return;
 
14
}
 
15
 
 
16
void endElement_(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name) {
 
17
    return;
 
18
}
 
19
void characters_(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch, int len) {
 
20
    return;
 
21
}
 
22
 
 
23
 
 
24
xmlSAXHandler handler = {
 
25
    NULL, /* internalSubset */
 
26
    NULL, /* isStandalone */
 
27
    NULL, /* hasInternalSubset */
 
28
    NULL, /* hasExternalSubset */
 
29
    NULL, /* resolveEntity */
 
30
    NULL, /* getEntity */
 
31
    NULL, /* entityDecl */
 
32
    NULL, /* notationDecl */
 
33
    NULL, /* attributeDecl */
 
34
    NULL, /* elementDecl */
 
35
    NULL, /* unparsedEntityDecl */
 
36
    NULL, /* setDocumentLocator */
 
37
    NULL, /* startDocument */
 
38
    NULL, /* endDocument */
 
39
    startElement_, /* startElement */
 
40
    endElement_, /* endElement */
 
41
    NULL, /* reference */
 
42
    characters_, /* characters */
 
43
    NULL, /* ignorableWhitespace */
 
44
    NULL, /* processingInstruction */
 
45
    NULL, /* comment */
 
46
    NULL, /* xmlParserWarning */
 
47
    NULL, /* xmlParserError */
 
48
    NULL, /* xmlParserError */
 
49
    NULL, /* getParameterEntity */
 
50
    NULL, /* cdataBlock; */
 
51
    NULL, /* externalSubset; */
 
52
#ifndef _SAX2_BENCHMARK
 
53
    1
 
54
#else
 
55
    XML_SAX2_MAGIC,    /* XML_SAX1_MAGIC, XML_SAX2_MAGIC */
 
56
    NULL,
 
57
    NULL, /* startElementNs */
 
58
    NULL, /* endElementNs */
 
59
    NULL  /* xmlStructuredErrorFunc */
 
60
#endif /* _SAX2_BENCHMARK */
 
61
};
 
62
 
 
63
void initXML(struct TestData *td) {
 
64
}
 
65
 
 
66
void releaseXML(struct TestData *td) {
 
67
    xmlCleanupParser();
 
68
}
 
69
 
 
70
void parseXML(struct TestData *td, unsigned long iter) {
 
71
    xmlSAXUserParseMemory(&handler,NULL,td->xml,td->xmllen);
 
72
}
 
73
 
 
74
int main(int argc, char *argv[]) {
 
75
    return Test(argc,argv);
 
76
}