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