/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 xsl/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
 
 
6
#define ORACLE_PARSER
 
7
#include "tools.h"
 
8
 
 
9
xmlctx  *ctx;
 
10
xmlctx  *xslCtx;
 
11
 
 
12
 
 
13
void initXML(struct TestData *td) {
 
14
    unsigned int ecode;
 
15
 
 
16
    ctx = xmlinit(&ecode, 0, 0, 0, 0, 0, 0, 0, 0);
 
17
    if (!ctx)
 
18
    {
 
19
        printf("Failed to initialze XML parser, error %u\n", (unsigned) ecode);
 
20
        exit(1);
 
21
    }
 
22
}
 
23
 
 
24
void initXML_Transformation(struct TestData *td) {
 
25
    unsigned int ecode;
 
26
 
 
27
    xslCtx = xmlinit(&ecode, 0, 0, 0, 0, 0, 0, 0, 0);
 
28
    if (!ctx)
 
29
    {
 
30
        printf("Failed to initialze XSL parser, error %u\n", (unsigned) ecode);
 
31
        exit(1);
 
32
    }
 
33
 
 
34
    ecode=xmlparsebuf(xslCtx,td->xsl,td->xsllen,0,XML_FLAG_DISCARD_WHITESPACE);
 
35
    if (ecode) {
 
36
        printf("Failed to parse XSL file, error %u\n", (unsigned) ecode);
 
37
        exit(1);
 
38
    }   
 
39
}
 
40
 
 
41
void releaseXML(struct TestData *td) {
 
42
        xmlterm(xslCtx);
 
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
        exit(1);
 
54
    }   
 
55
}
 
56
 
 
57
void transformXML(struct TestData *td, unsigned long iter) {
 
58
    unsigned int ecode;
 
59
    xmlctx  *resctx;
 
60
    xmlnode *result;
 
61
    
 
62
    resctx = xmlinit(&ecode, 0, 0, 0, 0, 0, 0, 0, 0);
 
63
    if (!ctx)
 
64
    {
 
65
        printf("Failed to initialze XSL Result parser, error %u\n", (unsigned) ecode);
 
66
        exit(1);
 
67
    }
 
68
 
 
69
    if (ecode = xslprocess(ctx, xslCtx, resctx, &result))
 
70
    {
 
71
        printf("XSL Transformation failed, error %u\n", (unsigned) ecode);
 
72
        exit(1);
 
73
    }
 
74
 
 
75
//    if (iter==td->iterations) printStream(stdout, result, 4, 0);
 
76
 
 
77
    xmlterm(resctx);
 
78
    xmlclean(ctx);
 
79
}
 
80
 
 
81
 
 
82
int main(int argc, char *argv[]) {
 
83
    return Test(argc,argv);
 
84
}