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
71
72
73
74
75
76
77
78
|
#include <stdio.h>
#include <sys/time.h>
#include <oratypes.h>
#include <oraxml.h>
#include <oraxsd.h>
#include "tools.h"
xmlctx *ctx;
xsdctx *scctx;
xsd *xsddoc;
xmlnode *node;
void initXML(struct TestData *td) {
unsigned int ecode;
ctx = xmlinit(&ecode, 0, 0, 0, 0, 0, 0, 0, 0);
if (!ctx)
{
printf("Failed to initialze XML parser, error %u\n", (unsigned) ecode);
exit(1);
}
}
void initXML_Validation(struct TestData *td) {
unsigned int ecode;
scctx=schemaInitialize(ctx,&ecode);
if (!scctx) {
printf("Failed to initialze Schema Validator, error %u\n", (unsigned) ecode);
exit(1);
}
ecode=schemaLoad(scctx,td->scfn,NULL,&xsddoc);
if (ecode) {
printf("Failed to parse xsd file, error %u\n", (unsigned) ecode);
}
}
void releaseXML(struct TestData *td) {
schemaTerminate(scctx);
xmlterm(ctx);
}
void parseXML(struct TestData *td, unsigned long iter) {
unsigned int ecode;
ecode=xmlparsebuf(ctx,td->xml,td->xmllen,0,XML_FLAG_DISCARD_WHITESPACE);
if (ecode) {
printf("Failed to parse XML file, error %u\n", (unsigned) ecode);
}
node=getDocumentElement(ctx);
}
void validateXML(struct TestData *td, unsigned long iter) {
unsigned int ecode;
oratext *errmsg;
ecode=schemaValidate(scctx,node,NULL);
if (ecode) {
printf("Validating of XML file failed, error %u\n", (unsigned) ecode);
}
/*
char mem[65535];
int memsize = 65535;
printBuffer(mem,memsize,node,0,0);
puts(mem);
*/
}
int main(int argc, char *argv[]) {
return Test(argc,argv);
}
|