Project

Profile

Help

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

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

1
#include "../../Saxon.C.API/SaxonCXPath.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=0, parCap;
14
    parCap = cap;
15
    sxnc_property * properties; /*!< array of properties used for the transformation as (string, string) pairs */
16
    properties;
17
    int propLen=0, propCap;
18
    propCap = cap;
19
    sxnc_environment * environi;
20
    sxnc_processor * processor;
21

    
22
    initSaxonc(&environi, &processor, &parameters, &properties, parCap, propCap);
23

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

    
41
    sxnc_value * result = evaluate(environi,&processor, NULL, "/out/person", 0, properties, 0, propLen);
42

    
43
 bool resultBool = effectiveBooleanValue(environi,&processor, NULL, "count(/out/person)>0", 0, properties, 0, propLen);
44
 
45
    if(!result) {
46
      printf("result is null");
47
    }else {
48
      printf("%s", getStringValue(environi, *result));
49
    }
50

    
51
   if(resultBool==1) {
52
      printf("Boolean result is as expected: true");
53
    }else {
54
      printf("Boolean result is incorrectly: false");
55
    }
56
      fflush(stdout);   
57

    
58
    finalizeJavaRT (environi->jvm);
59
    freeSaxonc(&environi, &processor, &parameters, &properties);
60
    return 0;
61

    
62
}
(10-10/14)