Project

Profile

Help

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

he / latest9.6 / hec / Saxon.C.API / XsltProcessor.cpp @ 0af164b2

1
// XsltProcessor.cpp : Defines the exported functions for the DLL application.
2
//
3

    
4
//#include "xsltProcessor.cc"
5

    
6
#include "XsltProcessor.h"
7
#include "XdmValue.h"
8
#include "XdmItem.h"
9
#include "XdmNode.h"
10
#include "XdmAtomicValue.h"
11
#ifdef DEBUG
12
#include <typeinfo> //used for testing only
13
#endif
14

    
15
XsltProcessor::XsltProcessor() {
16

    
17
        SaxonProcessor *p = new SaxonProcessor(false);
18
        XsltProcessor(p, "");
19

    
20
}
21

    
22
XsltProcessor::XsltProcessor(SaxonProcessor * p, std::string curr) {
23

    
24
        proc = p;
25

    
26
        /*
27
         * Look for class.
28
         */
29
        cppClass = lookForClass(sxn_environ->env,
30
                        "net/sf/saxon/option/cpp/XsltProcessor");
31
        if ((proc->proc) == NULL) {
32
                cerr << "Processor is NULL" << endl;
33
        }
34

    
35
        cppXT = createSaxonProcessor2(sxn_environ->env, cppClass,
36
                        "(Lnet/sf/saxon/s9api/Processor;)V", proc->proc);
37

    
38
#ifdef DEBUG
39
        jmethodID debugMID = sxn_environ->env->GetStaticMethodID(cppClass, "setDebugMode", "(Z)V");
40
        sxn_environ->env->CallStaticVoidMethod(cppClass, debugMID, (jboolean)true);
41
#endif    
42

    
43
        nodeCreated = false;
44
        proc->exception = NULL;
45
        outputfile1 = "";
46
        if(!(proc->cwd.empty()) && curr.empty()){
47
                cwdXT = proc->cwd;
48
        } else {
49
                cwdXT = curr;
50
        }
51

    
52
}
53

    
54
bool XsltProcessor::exceptionOccurred() {
55
        return proc->exceptionOccurred();
56
}
57

    
58
const char * XsltProcessor::getErrorCode(int i) {
59
 if(proc->exception == NULL) {return NULL;}
60
 return proc->exception->getErrorCode(i);
61
 }
62

    
63
void XsltProcessor::setSourceFromXdmValue(XdmItem * value) {
64
    if(value != NULL){
65
      value->incrementRefCount();
66
      parameters["node"] = value;
67
    }
68
}
69

    
70
void XsltProcessor::setSourceFromFile(const char * ifile) {
71
        setProperty("s", ifile);
72
}
73

    
74
void XsltProcessor::setOutputFile(const char * ofile) {
75
        outputfile1 = std::string(ofile);
76
        setProperty("o", ofile);
77
}
78

    
79
void XsltProcessor::setParameter(const char* name, XdmValue * value) {
80
        if(value != NULL){
81
                value->incrementRefCount();
82
                parameters["param:"+std::string(name)] = value;
83
        } 
84
}
85

    
86
XdmValue* XsltProcessor::getParameter(const char* name) {
87
        std::map<std::string, XdmValue*>::iterator it;
88
        it = parameters.find("param:"+std::string(name));
89
        if (it != parameters.end())
90
          return it->second;
91
        return NULL;
92
}
93

    
94
bool XsltProcessor::removeParameter(const char* name) {
95
        return (bool)(parameters.erase("param:"+string(name)));
96
}
97

    
98
void XsltProcessor::setProperty(const char* name, const char* value) {
99
#ifdef DEBUG        
100
        if(value == NULL) {
101
                std::cerr<<"XSLTProc setProperty is NULL"<<std::endl;
102
        }
103
#endif
104
        properties.insert(std::pair<std::string, std::string>(std::string(name), std::string((value == NULL ? "" : value))));
105

    
106
}
107

    
108
const char* XsltProcessor::getProperty(const char* name) {
109
        std::map<std::string, std::string>::iterator it;
110
        it = properties.find(std::string(name));
111
        if (it != properties.end())
112
          return it->second.c_str();
113
        return NULL;
114
}
115

    
116
void XsltProcessor::clearParameters(bool delValues) {
117
        if(delValues){
118
                       for(std::map<std::string, XdmValue*>::iterator itr = parameters.begin(); itr != parameters.end(); itr++){
119
                        //cout<<"param-name:"<<itr->first<<endl;
120
                        /*string s1 = typeid(itr->second).name();
121
                        cerr<<"Type of itr:"<<s1<<endl;*/
122
                        XdmValue * value = itr->second;
123
                        value->decrementRefCount();
124
#ifdef DEBUG
125
                        cout<<"clearParameter() - XdmValue refCount="<<value->getRefCount()<<endl;
126
#endif
127
                        if(value != NULL && value->getRefCount() < 1){                
128
                                delete value;
129
                        }
130
                }
131
                
132
        }
133
        parameters.clear();
134
}
135

    
136
void XsltProcessor::clearProperties() {
137
        properties.clear();
138
}
139

    
140

    
141

    
142
std::map<std::string,XdmValue*>& XsltProcessor::getParameters(){
143
        std::map<std::string,XdmValue*>& ptr = parameters;
144
        return ptr;
145
}
146

    
147
std::map<std::string,std::string>& XsltProcessor::getProperties(){
148
        std::map<std::string,std::string> &ptr = properties;
149
        return ptr;
150
}
151

    
152
void XsltProcessor::exceptionClear(){
153
 if(proc->exception != NULL) {
154
         delete proc->exception;
155
         proc->exception = NULL;
156
        sxn_environ->env->ExceptionClear();
157
 }
158
  
159
 }
160

    
161
   void XsltProcessor::setcwd(const char* dir){
162
    cwdXT = std::string(dir);
163
   }
164

    
165
const char* XsltProcessor::checkException() {
166
        /*if(proc->exception == NULL) {
167
         proc->exception = proc->checkForException(environ, cppClass, cpp);
168
         }
169
         return proc->exception;*/
170
        return checkForException(*(sxn_environ), cppClass, cppXT);
171
}
172

    
173
int XsltProcessor::exceptionCount(){
174
 if(proc->exception != NULL){
175
 return proc->exception->count();
176
 }
177
 return 0;
178
 }
179

    
180
void XsltProcessor::compileFromString(const char* stylesheetStr) {
181
        static jmethodID cStringmID =
182
                        (jmethodID) sxn_environ->env->GetMethodID(cppClass,
183
                                        "createStylesheetFromString",
184
                                        "(Ljava/lang/String;Ljava/lang/String;)Lnet/sf/saxon/s9api/XsltExecutable;");
185
        if (!cStringmID) {
186
                cerr << "Error: MyClassInDll." << "createStylesheetFromString"
187
                                << " not found\n" << endl;
188

    
189
        } else {
190

    
191
                stylesheetObject = (jobject)(
192
                                sxn_environ->env->CallObjectMethod(cppXT, cStringmID,
193
                                                sxn_environ->env->NewStringUTF(cwdXT.c_str()),
194
                                                sxn_environ->env->NewStringUTF(stylesheetStr)));
195
                if (!stylesheetObject) {
196
                        if(exceptionOccurred()) {
197
                                
198
                                if(proc->exception != NULL) {
199
                                        delete proc->exception;
200
                                }
201
                                proc->exception = proc->checkForExceptionCPP(sxn_environ->env, cppClass, NULL);
202
                                proc->exceptionClear();
203
                             }
204
                }
205
        }
206

    
207
}
208

    
209
void XsltProcessor::compileFromXdmNode(XdmNode * node) {
210
        static jmethodID cNodemID =
211
                        (jmethodID) sxn_environ->env->GetMethodID(cppClass,
212
                                        "createStylesheetFromFile",
213
                                        "(Ljava/lang/String;Lnet/sf/saxon/s9api/XdmNode;)Lnet/sf/saxon/s9api/XsltExecutable;");
214
        if (!cNodemID) {
215
                cerr << "Error: MyClassInDll." << "createStylesheetFromXdmNode"
216
                                << " not found\n" << endl;
217

    
218
        } else {
219
                releaseStylesheet();
220
                stylesheetObject = (jobject)(
221
                                sxn_environ->env->CallObjectMethod(cppXT, cNodemID,
222
                                                sxn_environ->env->NewStringUTF(cwdXT.c_str()),
223
                                                node->getUnderlyingValue(proc)));
224
                if (!stylesheetObject) {
225
                        if(exceptionOccurred()) {
226
                                if(proc->exception != NULL) {
227
                                        delete proc->exception;
228
                                }
229
                                proc->exception = proc->checkForExceptionCPP(sxn_environ->env, cppClass, NULL);
230
                                proc->exceptionClear();
231
                             }
232
                        //cout << "Error in compileFromXdmNode" << endl;
233
                }
234
        }
235

    
236
}
237

    
238
void XsltProcessor::compileFromFile(const char* stylesheet) {
239
        static jmethodID cFilemID =
240
                        (jmethodID) sxn_environ->env->GetMethodID(cppClass,
241
                                        "createStylesheetFromFile",
242
                                        "(Ljava/lang/String;Ljava/lang/String;)Lnet/sf/saxon/s9api/XsltExecutable;");
243
        if (!cFilemID) {
244
                cerr << "Error: MyClassInDll." << "createStylesheetFromFile"
245
                                << " not found\n" << endl;
246

    
247
        } else {
248
                releaseStylesheet();
249

    
250
                stylesheetObject = (jobject)(
251
                                sxn_environ->env->CallObjectMethod(cppXT, cFilemID,
252
                                                sxn_environ->env->NewStringUTF(cwdXT.c_str()),
253
                                                sxn_environ->env->NewStringUTF(stylesheet)));
254
                if (!stylesheetObject) {
255
                        if(exceptionOccurred()) {
256
                                
257
                                if(proc->exception != NULL) {
258
                                        delete proc->exception;
259
                                }
260
                                proc->exception = proc->checkForExceptionCPP(sxn_environ->env, cppClass, NULL);
261
                                proc->exceptionClear();
262
                           }
263
                     
264
                }
265
                //sxn_environ->env->NewGlobalRef(stylesheetObject);
266
        }
267

    
268
}
269

    
270
void XsltProcessor::releaseStylesheet() {
271

    
272
        stylesheetObject = NULL;
273
        
274
}
275

    
276

    
277

    
278
XdmValue * XsltProcessor::transformFileToValue(const char* sourcefile,
279
                const char* stylesheetfile) {
280

    
281
        if(sourcefile == NULL && stylesheetfile == NULL && !stylesheetObject){
282
                cerr<< "Error: The most recent Stylesheet Object failed. Please check exceptions"<<endl;
283
                return NULL;
284
        }
285

    
286
        setProperty("resources", proc->getResourcesDirectory());
287
        static jmethodID mID =
288
                        (jmethodID) sxn_environ->env->GetMethodID(cppClass,
289
                                        "transformToNode",
290
                                        "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;)Lnet/sf/saxon/s9api/XdmNode;");
291
        if (!mID) {
292
                cerr << "Error: MyClassInDll." << "transformtoNode" << " not found\n"
293
                                << endl;
294

    
295
        } else {
296
                jobjectArray stringArray = NULL;
297
                jobjectArray objectArray = NULL;
298
                jclass objectClass = lookForClass(sxn_environ->env,
299
                                "java/lang/Object");
300
                jclass stringClass = lookForClass(sxn_environ->env,
301
                                "java/lang/String");
302

    
303
                int size = parameters.size() + properties.size();
304
                if (size > 0) {
305
                        objectArray = sxn_environ->env->NewObjectArray((jint) size,
306
                                        objectClass, 0);
307
                        stringArray = sxn_environ->env->NewObjectArray((jint) size,
308
                                        stringClass, 0);
309
                        int i = 0;
310
                        for (map<std::string, XdmValue*>::iterator iter =
311
                                        parameters.begin(); iter != parameters.end(); ++iter, i++) {
312
                                sxn_environ->env->SetObjectArrayElement(stringArray, i,
313
                                                sxn_environ->env->NewStringUTF(
314
                                                                (iter->first).c_str()));
315
                                sxn_environ->env->SetObjectArrayElement(objectArray, i,
316
                                                (iter->second)->getUnderlyingValue(proc));
317
                        }
318
                        for (map<std::string, std::string>::iterator iter =
319
                                        properties.begin(); iter != properties.end(); ++iter, i++) {
320
                                sxn_environ->env->SetObjectArrayElement(stringArray, i,
321
                                                sxn_environ->env->NewStringUTF(
322
                                                                (iter->first).c_str()));
323
                                sxn_environ->env->SetObjectArrayElement(objectArray, i,
324
                                                sxn_environ->env->NewStringUTF(
325
                                                                (iter->second).c_str()));
326
                        }
327
                }
328
                jobject result = (jobject)(
329
                                sxn_environ->env->CallObjectMethod(cppXT, mID,
330
                                                sxn_environ->env->NewStringUTF(cwdXT.c_str()),
331
                                                (sourcefile != NULL ?
332
                                                                sxn_environ->env->NewStringUTF(sourcefile) :
333
                                                                NULL),
334
                                                (stylesheetfile != NULL ?
335
                                                                sxn_environ->env->NewStringUTF(
336
                                                                                stylesheetfile) :
337
                                                                NULL), stringArray, objectArray));
338
                if (size > 0) {
339
                        sxn_environ->env->DeleteLocalRef(stringArray);
340
                        sxn_environ->env->DeleteLocalRef(objectArray);
341
                }
342
                if (result) {
343
                        XdmNode * node = new XdmNode(result);
344
                        node->setProcessor(proc);
345
                        return node;
346
                }else if(exceptionOccurred()) {
347
        
348
                        if(proc->exception != NULL) {
349
                                delete proc->exception;
350
                        }
351
                        proc->exception = proc->checkForExceptionCPP(sxn_environ->env, cppClass, NULL);
352
                        proc->exceptionClear();
353
                           
354
                     }
355
        }
356
        return NULL;
357

    
358
}
359

    
360

    
361
void XsltProcessor::transformFileToFile(const char* source,
362
                const char* stylesheet, const char* outputfile) {
363

    
364
        if(source == NULL && outputfile == NULL && !stylesheetObject){
365
                cerr<< "Error: The most recent Stylesheet Object failed. Please check exceptions"<<endl;
366
                return;
367
        }
368
        setProperty("resources", proc->getResourcesDirectory());
369
        jmethodID mID =
370
                        (jmethodID) sxn_environ->env->GetMethodID(cppClass,
371
                                        "transformToFile",
372
                                        "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;)V");
373
        if (!mID) {
374
                cerr << "Error: MyClassInDll." << "transformToFile" << " not found\n"
375
                                << endl;
376

    
377
        } else {
378
                jobjectArray stringArray = NULL;
379
                jobjectArray objectArray = NULL;
380
                jclass objectClass = lookForClass(sxn_environ->env,
381
                                "java/lang/Object");
382
                jclass stringClass = lookForClass(sxn_environ->env,
383
                                "java/lang/String");
384

    
385
                int size = parameters.size() + properties.size();
386
#ifdef DEBUG
387
                cerr<<"Properties size: "<<properties.size()<<endl;
388
                cerr<<"Parameter size: "<<parameters.size()<<endl;
389
                cerr<<"size:"<<size<<endl;
390
#endif
391
                if (size > 0) {
392
                        objectArray = sxn_environ->env->NewObjectArray((jint) size,
393
                                        objectClass, 0);
394
                        stringArray = sxn_environ->env->NewObjectArray((jint) size,
395
                                        stringClass, 0);
396
                        if (objectArray == NULL) {
397
                                cerr << "objectArray is NULL" << endl;
398
                        }
399
                        if (stringArray == NULL) {
400
                                cerr << "stringArray is NULL" << endl;
401
                        }
402
                        int i = 0;
403
                        for (map<std::string, XdmValue*>::iterator iter =
404
                                        parameters.begin(); iter != parameters.end(); ++iter, i++) {
405

    
406
#ifdef DEBUG
407
                                cerr<<"map 1"<<endl;
408
                                cerr<<"iter->first"<<(iter->first).c_str()<<endl;
409
#endif
410
                                sxn_environ->env->SetObjectArrayElement(stringArray, i,
411
                                                sxn_environ->env->NewStringUTF(
412
                                                                (iter->first).c_str()));
413
#ifdef DEBUG
414
                                string s1 = typeid(iter->second).name();
415
                                cerr<<"Type of itr:"<<s1<<endl;
416
                                jobject xx = (iter->second)->getUnderlyingValue(proc);
417
                                if(xx == NULL) {
418
                                        cerr<<"value failed"<<endl;
419
                                } else {
420

    
421
                                        cerr<<"Type of value:"<<(typeid(xx).name())<<endl;
422
                                }
423
                                if((iter->second)->getUnderlyingValue(proc) == NULL) {
424
                                        cerr<<"(iter->second)->getUnderlyingValue() is NULL"<<endl;
425
                                }
426
#endif
427
                                sxn_environ->env->SetObjectArrayElement(objectArray, i,
428
                                                (iter->second)->getUnderlyingValue(proc));
429

    
430
                        }
431

    
432
                        for (map<std::string, std::string>::iterator iter =
433
                                        properties.begin(); iter != properties.end(); ++iter, i++) {
434
                                sxn_environ->env->SetObjectArrayElement(stringArray, i,
435
                                                sxn_environ->env->NewStringUTF(
436
                                                                (iter->first).c_str()));
437
                                sxn_environ->env->SetObjectArrayElement(objectArray, i,
438
                                                sxn_environ->env->NewStringUTF(
439
                                                                (iter->second).c_str()));
440
                        }
441
                }
442
                sxn_environ->env->CallObjectMethod(cppXT, mID,
443
                                                                sxn_environ->env->NewStringUTF(cwdXT.c_str()),
444
                                                                (source != NULL ?
445
                                                                                sxn_environ->env->NewStringUTF(
446
                                                                                                source) :
447
                                                                                NULL),
448
                                                                sxn_environ->env->NewStringUTF(stylesheet),NULL,
449
                                                                stringArray, objectArray);
450
                if (size > 0) {
451
                        sxn_environ->env->DeleteLocalRef(stringArray);
452
                        sxn_environ->env->DeleteLocalRef(objectArray);
453
                }
454
                
455
        }
456

    
457
        if(exceptionOccurred()) {
458
                        if(proc->exception != NULL) {
459
                                delete proc->exception;
460
                        }
461
                        proc->exception = proc->checkForExceptionCPP(sxn_environ->env, cppClass, NULL);
462
                        proc->exceptionClear();
463
                           
464
                     }
465

    
466

    
467
}
468

    
469

    
470
XdmValue * XsltProcessor::getXslMessages(){
471

    
472
jmethodID mID =   (jmethodID) sxn_environ->env->GetMethodID(cppClass,
473
                                        "getXslMessages",
474
                                        "()[Lnet/sf/saxon/s9api/XdmValue;");
475
        if (!mID) {
476
                cerr << "Error: MyClassInDll." << "transformToString" << " not found\n"
477
                                << endl;
478

    
479
        } else {
480
jobjectArray results = (jobjectArray)(
481
                        sxn_environ->env->CallObjectMethod(cppXT, mID));
482
        int sizex = sxn_environ->env->GetArrayLength(results);
483

    
484
        if (sizex>0) {
485
                XdmValue * value = new XdmValue();
486
                
487
                for (int p=0; p < sizex; ++p) 
488
                {
489
                        jobject resulti = sxn_environ->env->GetObjectArrayElement(results, p);
490
                        value->addUnderlyingValue(resulti);
491
                }
492
                sxn_environ->env->DeleteLocalRef(results);
493
                return value;
494
        }
495
    }
496
    return NULL;
497

    
498

    
499
}
500

    
501
const char * XsltProcessor::transformFileToString(const char* source,
502
                const char* stylesheet) {
503
        if(source == NULL && stylesheet == NULL && !stylesheetObject){
504
                cerr<< "Error: The most recent StylesheetObject failed. Please check exceptions"<<endl;
505
                return NULL;
506
        }
507
        setProperty("resources", proc->getResourcesDirectory());
508
        jmethodID mID =
509
                        (jmethodID) sxn_environ->env->GetMethodID(cppClass,
510
                                        "transformToString",
511
                                        "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;");
512
        if (!mID) {
513
                cerr << "Error: MyClassInDll." << "transformFileToString" << " not found\n"
514
                                << endl;
515

    
516
        } else {
517
                jobjectArray stringArray = NULL;
518
                jobjectArray objectArray = NULL;
519
                jclass objectClass = lookForClass(sxn_environ->env,
520
                                "java/lang/Object");
521
                jclass stringClass = lookForClass(sxn_environ->env,
522
                                "java/lang/String");
523

    
524
                int size = parameters.size() + properties.size();
525
#ifdef DEBUG
526
                cerr<<"Properties size: "<<properties.size()<<endl;
527
                cerr<<"Parameter size: "<<parameters.size()<<endl;
528
#endif
529
                if (size > 0) {
530
                        objectArray = sxn_environ->env->NewObjectArray((jint) size,
531
                                        objectClass, 0);
532
                        stringArray = sxn_environ->env->NewObjectArray((jint) size,
533
                                        stringClass, 0);
534
                        if (objectArray == NULL) {
535
                                cerr << "objectArray is NULL" << endl;
536
                        }
537
                        if (stringArray == NULL) {
538
                                cerr << "stringArray is NULL" << endl;
539
                        }
540
                        int i = 0;
541
                        for (map<std::string, XdmValue*>::iterator iter =
542
                                        parameters.begin(); iter != parameters.end(); ++iter, i++) {
543

    
544
#ifdef DEBUG
545
                                cerr<<"map 1"<<endl;
546
                                cerr<<"iter->first"<<(iter->first).c_str()<<endl;
547
#endif
548
                                sxn_environ->env->SetObjectArrayElement(stringArray, i,
549
                                                sxn_environ->env->NewStringUTF(
550
                                                                (iter->first).c_str()));
551
#ifdef DEBUG
552
                                string s1 = typeid(iter->second).name();
553
                                cerr<<"Type of itr:"<<s1<<endl;
554
                                jobject xx = (iter->second)->getUnderlyingValue(proc);
555
                                if(xx == NULL) {
556
                                        cerr<<"value failed"<<endl;
557
                                } else {
558

    
559
                                        cerr<<"Type of value:"<<(typeid(xx).name())<<endl;
560
                                }
561
                                if((iter->second)->getUnderlyingValue(proc) == NULL) {
562
                                        cerr<<"(iter->second)->getUnderlyingValue() is NULL"<<endl;
563
                                }
564
#endif
565
                                sxn_environ->env->SetObjectArrayElement(objectArray, i,
566
                                                (iter->second)->getUnderlyingValue(proc));
567

    
568
                        }
569

    
570
                        for (map<std::string, std::string>::iterator iter =
571
                                        properties.begin(); iter != properties.end(); ++iter, i++) {
572
                                sxn_environ->env->SetObjectArrayElement(stringArray, i,
573
                                                sxn_environ->env->NewStringUTF(
574
                                                                (iter->first).c_str()));
575
                                sxn_environ->env->SetObjectArrayElement(objectArray, i,
576
                                                sxn_environ->env->NewStringUTF(
577
                                                                (iter->second).c_str()));
578
                        }
579
                }
580

    
581
        jstring result = NULL;
582
        jobject obj =
583
                                (
584
                                                sxn_environ->env->CallObjectMethod(cppXT, mID,
585
                                                                sxn_environ->env->NewStringUTF(cwdXT.c_str()),
586
                                                                (source != NULL ?
587
                                                                                sxn_environ->env->NewStringUTF(
588
                                                                                                source) :
589
                                                                                NULL),
590
                                                                sxn_environ->env->NewStringUTF(stylesheet),
591
                                                                stringArray, objectArray));
592
                if(obj) {
593
                        result = (jstring)obj;
594
                }                
595
                if (size > 0) {
596
                        sxn_environ->env->DeleteLocalRef(stringArray);
597
                        sxn_environ->env->DeleteLocalRef(objectArray);
598
                }
599
                if (result) {
600
                        const char * str = sxn_environ->env->GetStringUTFChars(result,
601
                                        NULL);
602
                        //return "result should be ok";
603
                        return str;
604
                } else if(exceptionOccurred()) {
605
                        if(proc->exception != NULL) {
606
                                delete proc->exception;
607
                        }
608
                        proc->exception = proc->checkForExceptionCPP(sxn_environ->env, cppClass, NULL);
609
                        proc->exceptionClear();
610
                           
611
                     }
612
        }
613

    
614
        return NULL;
615
}
616

    
617

    
618
   const char * XsltProcessor::transformToString(){
619
        if(!stylesheetObject){
620
                cerr<< "Error: The most recent Stylesheet Object failed or has not been set."<<endl;
621
                return NULL;
622
        }
623
        return transformFileToString(NULL, NULL);
624
   }
625

    
626

    
627
    XdmValue * XsltProcessor::transformToValue(){
628
        if(!stylesheetObject){
629
                cerr<< "Error: The most recent Stylesheet Object failed or has not been set."<<endl;
630
                return NULL;
631
        }
632
        return transformFileToValue(NULL, NULL);
633
   }
634

    
635
    void XsltProcessor::transformToFile(){
636
        if(!stylesheetObject){
637
                cerr<< "Error: The most recent Stylesheet Object failed or has not been set."<<endl;
638
                return;
639
        }
640
        transformFileToFile(NULL, NULL, NULL);
641
   }
642

    
643
const char * XsltProcessor::getErrorMessage(int i ){
644
 if(proc->exception == NULL) {return NULL;}
645
 return proc->exception->getErrorMessage(i);
646
 }
647

    
(26-26/37)