/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/oracle-sax.cpp

  • 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 <oraxml.hpp>
 
4
 
 
5
#define DTD_VALIDATION_SUPPORTED
 
6
#include "tools.h"
 
7
 
 
8
int startDocument(void *ctx) {
 
9
    return 0;
 
10
}
 
11
int endDocument(void *ctx) {
 
12
    return 0;
 
13
}
 
14
int startElement(void *ctx, const oratext *name, const struct xmlnodes *attrs) {
 
15
    return 0;
 
16
}
 
17
int endElement(void *ctx, const oratext *name) {
 
18
    return 0;
 
19
}
 
20
int characters(void *ctx, const oratext *ch, size_t len) {
 
21
    return 0;
 
22
}
 
23
 
 
24
xmlsaxcb saxcb = {
 
25
    startDocument,
 
26
    endDocument,
 
27
    startElement,
 
28
    endElement,
 
29
    characters
 
30
};
 
31
 
 
32
XMLParser *parser;
 
33
 
 
34
void initXML(struct TestData *td) {
 
35
    unsigned int ecode;
 
36
    parser=new XMLParser;
 
37
    ecode=parser->xmlinit(0,0,0,&saxcb);
 
38
    if (ecode)
 
39
    {
 
40
        fprintf(stderr,"Failed to initialze XML parser, error %u\n", (unsigned) ecode);
 
41
        exit(1);
 
42
    }
 
43
}
 
44
 
 
45
void releaseXML(struct TestData *td) {
 
46
    parser->xmlterm();
 
47
    delete parser;
 
48
}
 
49
 
 
50
void parseXML(struct TestData *td, unsigned long iter) {
 
51
    unsigned int ecode;
 
52
    
 
53
#ifdef DTD_VALIDATION
 
54
    ecode=parser->xmlparseBuffer((oratext*)td->xml,td->xmllen,0,XML_FLAG_DISCARD_WHITESPACE|XML_FLAG_VALIDATE);
 
55
#else
 
56
    ecode=parser->xmlparseBuffer((oratext*)td->xml,td->xmllen,0,XML_FLAG_DISCARD_WHITESPACE);
 
57
#endif
 
58
    if (ecode) {
 
59
        fprintf(stderr,"Failed to parse XML file, error %u\n", (unsigned) ecode);
 
60
        exit(1);
 
61
    }   
 
62
//    parser->xmlclean();
 
63
    parser->xmlterm();
 
64
    parser->xmlinit(0,0,0,&saxcb);
 
65
}
 
66
 
 
67
 
 
68
int main(int argc, char *argv[]) {
 
69
    return Test(argc,argv);
 
70
}