/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/faxpp-pull.c

  • Committer: Suren A. Chilingaryan
  • Date: 2009-10-08 03:17:59 UTC
  • Revision ID: csa@dside.dyndns.org-20091008031759-u5ys779huye7feni
LibXML Pull Parser, FAXPP Parser, Mono security benchmark, multiple fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
#include <sys/time.h>
 
3
 
 
4
#include <faxpp/parser.h>
 
5
 
 
6
#include "tools.h"
 
7
 
 
8
 
 
9
FAXPP_Parser *parser;
 
10
 
 
11
void initXML(struct TestData *td) {
 
12
    parser = FAXPP_create_parser(fast_mode?NO_CHECKS_PARSE_MODE:WELL_FORMED_PARSE_MODE, FAXPP_utf8_transcoder);
 
13
    FAXPP_set_null_terminate(parser, 0);
 
14
//    FAXPP_set_null_terminate(parser, fast_mode?0:1);
 
15
//    FAXPP_set_base_uri_str(parser, "xml");
 
16
}
 
17
 
 
18
void releaseXML(struct TestData *td) {
 
19
  FAXPP_free_parser(parser);
 
20
}
 
21
 
 
22
void parseXML(struct TestData *td, unsigned long iter) {
 
23
    int i;
 
24
    int err;
 
25
 
 
26
    FAXPP_init_parse(parser, td->xml, td->xmllen, 1);
 
27
 
 
28
    err = FAXPP_next_event(parser);
 
29
    while(!err) {
 
30
        const FAXPP_Event *ev = FAXPP_get_current_event(parser);
 
31
        
 
32
//      printf("%i\n", ev->type);
 
33
        
 
34
        if (ev->type == START_ELEMENT_EVENT) {
 
35
            for (i = 0; i < ev->attr_count; i++) {
 
36
                ev->attrs[i];
 
37
            }
 
38
        }
 
39
        else if(ev->type == END_DOCUMENT_EVENT) {
 
40
            break;
 
41
        }
 
42
        err = FAXPP_next_event(parser);
 
43
    }
 
44
 
 
45
    if (err) {
 
46
        printf("Parsing is failed with code: %s\n", FAXPP_err_to_string(err));
 
47
        exit(1);
 
48
    }
 
49
}
 
50
 
 
51
int main(int argc, char *argv[]) {
 
52
    return Test(argc,argv);
 
53
}