3
#include <libxml/xmlmemory.h>
4
#include <libxml/parser.h>
8
#if LIBXML_VERSION > 20600
9
#define _SAX2_BENCHMARK
12
void startElement_(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, const xmlChar **atts) {
16
void endElement_(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name) {
19
void characters_(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch, int len) {
24
xmlSAXHandler handler = {
25
NULL, /* internalSubset */
26
NULL, /* isStandalone */
27
NULL, /* hasInternalSubset */
28
NULL, /* hasExternalSubset */
29
NULL, /* resolveEntity */
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 */
42
characters_, /* characters */
43
NULL, /* ignorableWhitespace */
44
NULL, /* processingInstruction */
46
NULL, /* xmlParserWarning */
47
NULL, /* xmlParserError */
48
NULL, /* xmlParserError */
49
NULL, /* getParameterEntity */
50
NULL, /* cdataBlock; */
51
NULL, /* externalSubset; */
52
#ifndef _SAX2_BENCHMARK
55
XML_SAX2_MAGIC, /* XML_SAX1_MAGIC, XML_SAX2_MAGIC */
57
NULL, /* startElementNs */
58
NULL, /* endElementNs */
59
NULL /* xmlStructuredErrorFunc */
60
#endif /* _SAX2_BENCHMARK */
63
void initXML(struct TestData *td) {
66
void releaseXML(struct TestData *td) {
70
void parseXML(struct TestData *td, unsigned long iter) {
71
xmlSAXUserParseMemory(&handler,NULL,td->xml,td->xmllen);
74
int main(int argc, char *argv[]) {
75
return Test(argc,argv);