/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 validate/oracle-dom.c

  • 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 <oratypes.h>
 
4
#include <oraxml.h>
 
5
#include <oraxsd.h>
 
6
 
 
7
#include "tools.h"
 
8
 
 
9
xmlctx  *ctx;
 
10
xsdctx  *scctx; 
 
11
xsd     *xsddoc;
 
12
xmlnode *node;
 
13
 
 
14
 
 
15
void initXML(struct TestData *td) {
 
16
    unsigned int ecode;
 
17
    
 
18
    
 
19
    ctx = xmlinit(&ecode, 0, 0, 0, 0, 0, 0, 0, 0);
 
20
    if (!ctx)
 
21
    {
 
22
        printf("Failed to initialze XML parser, error %u\n", (unsigned) ecode);
 
23
        exit(1);
 
24
    }
 
25
}
 
26
 
 
27
void initXML_Validation(struct TestData *td) {
 
28
    unsigned int ecode;
 
29
    scctx=schemaInitialize(ctx,&ecode);
 
30
    if (!scctx) {
 
31
        printf("Failed to initialze Schema Validator, error %u\n", (unsigned) ecode);
 
32
        exit(1);
 
33
    }
 
34
 
 
35
    ecode=schemaLoad(scctx,td->scfn,NULL,&xsddoc);
 
36
    if (ecode) {
 
37
        printf("Failed to parse xsd file, error %u\n", (unsigned) ecode);    
 
38
    }
 
39
}
 
40
 
 
41
void releaseXML(struct TestData *td) {
 
42
        schemaTerminate(scctx);
 
43
        xmlterm(ctx);
 
44
}
 
45
 
 
46
 
 
47
void parseXML(struct TestData *td, unsigned long iter) {
 
48
    unsigned int ecode;
 
49
 
 
50
    ecode=xmlparsebuf(ctx,td->xml,td->xmllen,0,XML_FLAG_DISCARD_WHITESPACE);
 
51
    if (ecode) {
 
52
        printf("Failed to parse XML file, error %u\n", (unsigned) ecode);
 
53
    }   
 
54
 
 
55
    node=getDocumentElement(ctx);
 
56
}
 
57
 
 
58
void validateXML(struct TestData *td, unsigned long iter) {
 
59
    unsigned int ecode;
 
60
    oratext *errmsg;
 
61
    
 
62
    ecode=schemaValidate(scctx,node,NULL);
 
63
    if (ecode) {
 
64
        printf("Validating of XML file failed, error %u\n", (unsigned) ecode);
 
65
    }   
 
66
/*
 
67
    char mem[65535];
 
68
    int memsize = 65535;
 
69
    printBuffer(mem,memsize,node,0,0);
 
70
    puts(mem);
 
71
*/
 
72
 
 
73
}
 
74
 
 
75
 
 
76
int main(int argc, char *argv[]) {
 
77
    return Test(argc,argv);
 
78
}