/xmlbench/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/xmlbench/trunk
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
#include <stdio.h>
#include <sys/time.h>
#include <oraxml.hpp>

#define DTD_VALIDATION_SUPPORTED
#include "tools.h"

int startDocument(void *ctx) {
    return 0;
}
int endDocument(void *ctx) {
    return 0;
}
int startElement(void *ctx, const oratext *name, const struct xmlnodes *attrs) {
    return 0;
}
int endElement(void *ctx, const oratext *name) {
    return 0;
}
int characters(void *ctx, const oratext *ch, size_t len) {
    return 0;
}

xmlsaxcb saxcb = {
    startDocument,
    endDocument,
    startElement,
    endElement,
    characters
};

XMLParser *parser;

void initXML(struct TestData *td) {
    unsigned int ecode;
    parser=new XMLParser;
    ecode=parser->xmlinit(0,0,0,&saxcb);
    if (ecode)
    {
        fprintf(stderr,"Failed to initialze XML parser, error %u\n", (unsigned) ecode);
        exit(1);
    }
}

void releaseXML(struct TestData *td) {
    parser->xmlterm();
    delete parser;
}

void parseXML(struct TestData *td, unsigned long iter) {
    unsigned int ecode;
    
#ifdef DTD_VALIDATION
    ecode=parser->xmlparseBuffer((oratext*)td->xml,td->xmllen,0,XML_FLAG_DISCARD_WHITESPACE|XML_FLAG_VALIDATE);
#else
    ecode=parser->xmlparseBuffer((oratext*)td->xml,td->xmllen,0,XML_FLAG_DISCARD_WHITESPACE);
#endif
    if (ecode) {
	fprintf(stderr,"Failed to parse XML file, error %u\n", (unsigned) ecode);
	exit(1);
    }	
//    parser->xmlclean();
    parser->xmlterm();
    parser->xmlinit(0,0,0,&saxcb);
}


int main(int argc, char *argv[]) {
    return Test(argc,argv);
}