Project

Profile

Help

How to connect?
Download (1.69 KB) Statistics
| Branch: | Revision:

he / src / main / c / samples / cTests / testXQuery.c @ f299305b

1
#include "../../Saxon.C.API/SaxonCProcessor.h"
2

    
3

    
4
int main()
5
{
6
    HANDLE myDllHandle;
7
    //JNIEnv *(environi.env);
8
    //JavaVM *jvm;
9
    jclass  myClassInDll;
10
    int cap = 10;
11
    sxnc_parameter * parameters; /*!< array of paramaters used for the transformation as (string, value) pairs */
12
    parameters;
13
    int parLen, parCap;
14
     parLen = 0;
15
    parCap = cap;
16
    sxnc_property * properties; /*!< array of properties used for the transformation as (string, string) pairs */
17
    properties;
18
    int propLen, propCap;
19
    propCap = cap;
20
    propLen =0;
21
    sxnc_environment * environi;
22
    sxnc_processor * processor;
23

    
24
    initSaxonc(&environi, &processor, &parameters, &properties, parCap, propCap);
25

    
26
    /*
27
     * First of all, load required component.
28
     * By the time of JET initialization, all components should be loaded.
29
     */
30
    environi->myDllHandle = loadDefaultDll ();
31
        
32
    /*
33
     * Initialize JET run-time.
34
     * The handle of loaded component is used to retrieve Invocation API.
35
     */
36
    initDefaultJavaRT (&environi);
37
    //initJavaRT (environi->myDllHandle, &(environi->jvm), &(environi->env));
38
    const char *verCh = version(*environi);
39
    printf("XQuery Tests\n\nSaxon version: %s \n", verCh);
40

    
41
    setProperty(&properties, &propLen, &propCap, "s", "cat.xml");
42

    
43
    setProperty(&properties, &propLen, &propCap, "qs", "<out>{count(/out/person)}</out>");
44

    
45
    const char * result = executeQueryToString(environi, &processor, NULL, 0,properties,0,propLen);
46

    
47
    if(!result) {
48
      printf("result is null\n");
49
    }else {
50
      printf("%s",result);
51
    }
52
    fflush(stdout);
53
    finalizeJavaRT (environi->jvm);
54
    freeSaxonc(&environi, &processor, &parameters, &properties);
55

    
56
    return 0;
57
}
(12-12/14)