bzr branch
http://darksoft.org/webbzr/xmlbench/trunk
1
by Suren A. Chilingaryan
Initial import |
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 |
}
|