/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/expat-sablotron-dom.cpp

  • 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 <sablot.h>
 
4
 
 
5
#include "tools.h"
 
6
 
 
7
SablotSituation parser;
 
8
SDOM_Document dom;
 
9
SDOM_Document xsl;
 
10
SablotHandle processor;
 
11
 
 
12
void initXML(struct TestData *td) {
 
13
    SablotCreateSituation(&parser);
 
14
}
 
15
 
 
16
void initXML_Transformation(struct TestData *td) {
 
17
    SablotParseStylesheetBuffer(parser, td->xsl, &xsl);
 
18
    SablotCreateProcessorForSituation(parser, &processor);
 
19
}
 
20
 
 
21
void releaseXML(struct TestData *td) {
 
22
    SablotDestroyDocument(parser,xsl);
 
23
    SablotDestroyProcessor(processor);
 
24
    SablotDestroySituation(parser);
 
25
}
 
26
 
 
27
 
 
28
void parseXML(struct TestData *td, unsigned long iter) {
 
29
    if (SablotParseBuffer(parser,td->xml,&dom)) {
 
30
        printf("Error parsing document!\n");
 
31
        exit(1);
 
32
    }
 
33
 
 
34
}
 
35
 
 
36
void transformXML(struct TestData *td, unsigned long iter) {
 
37
    char * result;
 
38
    SablotAddArgTree(parser, processor, "xsl", xsl);
 
39
    SablotAddArgTree(parser, processor, "xml", dom);
 
40
    SablotRunProcessorGen(parser, processor, "arg:/xsl", "arg:/xml", "arg:/res");
 
41
    SablotGetResultArg(processor, "arg:/res", &result);
 
42
    
 
43
//    if (iter==td->iterations) puts(result);
 
44
 
 
45
    SablotFree(result);
 
46
    SablotDestroyDocument(parser,dom);
 
47
}
 
48
 
 
49
 
 
50
int main(int argc, char *argv[]) {
 
51
    return Test(argc,argv);
 
52
}