Project

Profile

Help

Revision 0af164b2

Added by O'Neil Delpratt over 5 years ago

Saxon/C bug fix relating to issue 2772

View differences:

latest9.6/hec/Saxon.C.API/SaxonProcessor.cpp
28 28

  
29 29
//jobject cpp;
30 30
const char * failure;
31
sxnc_environment * environ = 0;
31
sxnc_environment * sxn_environ = 0;
32 32
int refCount = 0;
33 33
int jvmCreatedCPP=0;
34 34

  
35 35
bool SaxonProcessor::exceptionOccurred(){
36
	return environ->env->ExceptionCheck();
36
	return sxn_environ->env->ExceptionCheck();
37 37
}
38 38

  
39 39
void SaxonProcessor::exceptionClear(){
40
	environ->env->ExceptionClear();
40
	sxn_environ->env->ExceptionClear();
41 41
}
42 42

  
43 43
SaxonApiException * SaxonProcessor::getException(){
......
141 141

  
142 142
     if(jvmCreatedCPP == 0){
143 143
	jvmCreatedCPP=1;
144
    environ = new sxnc_environment;//(sxnc_environment *)malloc(sizeof(sxnc_environment));
144
    sxn_environ= new sxnc_environment;//(sxnc_environment *)malloc(sizeof(sxnc_environment));
145 145

  
146 146

  
147 147
    /*
......
149 149
     * By the time of JET initialization, all components should be loaded.
150 150
     */
151 151

  
152
    environ->myDllHandle = loadDefaultDll ();
152
    sxn_environ->myDllHandle = loadDefaultDll ();
153 153

  
154 154
    /*
155 155
     * Initialize JET run-time.
156 156
     * The handle of loaded component is used to retrieve Invocation API.
157 157
     */
158
    initDefaultJavaRT (&environ); 
158
    initDefaultJavaRT (&sxn_environ); 
159 159
    } else {
160 160
#ifdef DEBUG
161 161
     std::cerr<<"SaxonProc constructor: jvm exists!"<<std::endl;
......
164 164
}
165 165

  
166 166
 
167
    versionClass = lookForClass(environ->env, "net/sf/saxon/Version");
168
    procClass = lookForClass(environ->env, "net/sf/saxon/s9api/Processor");
169
    saxonCAPIClass = lookForClass(environ->env, "net/sf/saxon/option/cpp/SaxonCAPI");
167
    versionClass = lookForClass(sxn_environ->env, "net/sf/saxon/Version");
168
    procClass = lookForClass(sxn_environ->env, "net/sf/saxon/s9api/Processor");
169
    saxonCAPIClass = lookForClass(sxn_environ->env, "net/sf/saxon/option/cpp/SaxonCAPI");
170 170
    
171
    proc = createSaxonProcessor (environ->env, procClass, "(Z)V", NULL, licensei);
171
    proc = createSaxonProcessor (sxn_environ->env, procClass, "(Z)V", NULL, licensei);
172 172
	if(!proc) {
173 173
		std::cout<<"proc is NULL in SaxonProcessor constructor"<<std::endl;
174 174
	}
175 175

  
176
    xdmAtomicClass = lookForClass(environ->env, "net/sf/saxon/s9api/XdmAtomicValue");
176
    xdmAtomicClass = lookForClass(sxn_environ->env, "net/sf/saxon/s9api/XdmAtomicValue");
177 177
}
178 178

  
179 179
SaxonProcessor::SaxonProcessor(const char * configFile){
......
183 183

  
184 184
    if(jvmCreatedCPP == 0){
185 185
	jvmCreatedCPP=1;
186
    //environ = new sxnc_environment;
187
	environ = (sxnc_environment *)malloc(sizeof(sxnc_environment));
186
    //sxn_environ= new sxnc_environment;
187
	sxn_environ= (sxnc_environment *)malloc(sizeof(sxnc_environment));
188 188

  
189 189
    /*
190 190
     * First of all, load required component.
191 191
     * By the time of JET initialization, all components should be loaded.
192 192
     */
193 193

  
194
    environ->myDllHandle = loadDefaultDll ();
194
    sxn_environ->myDllHandle = loadDefaultDll ();
195 195

  
196 196
    /*
197 197
     * Initialize JET run-time.
198 198
     * The handle of loaded component is used to retrieve Invocation API.
199 199
     */
200
    initDefaultJavaRT (&environ); 
200
    initDefaultJavaRT (&sxn_environ); 
201 201
    }
202 202
 
203
    versionClass = lookForClass(environ->env, "net/sf/saxon/Version");
203
    versionClass = lookForClass(sxn_environ->env, "net/sf/saxon/Version");
204 204

  
205
    procClass = lookForClass(environ->env, "net/sf/saxon/s9api/Processor");
206
    saxonCAPIClass = lookForClass(environ->env, "net/sf/saxon/option/cpp/SaxonCAPI");
205
    procClass = lookForClass(sxn_environ->env, "net/sf/saxon/s9api/Processor");
206
    saxonCAPIClass = lookForClass(sxn_environ->env, "net/sf/saxon/option/cpp/SaxonCAPI");
207 207

  
208
     static jmethodID mIDcreateProc = (jmethodID)environ->env->GetStaticMethodID(saxonCAPIClass,"createSaxonProcessor",
208
     static jmethodID mIDcreateProc = (jmethodID)sxn_environ->env->GetStaticMethodID(saxonCAPIClass,"createSaxonProcessor",
209 209
					"(Ljava/lang/String;)Lnet/sf/saxon/s9api/Processor;");
210 210
		if (!mIDcreateProc) {
211 211
			std::cerr << "Error: SaxonDll." << "getPrimitiveTypeName"
212 212
				<< " not found\n" << std::endl;
213 213
			return ;
214 214
		}
215
	proc = environ->env->CallStaticObjectMethod(saxonCAPIClass, mIDcreateProc,environ->env->NewStringUTF(configFile));
215
	proc = sxn_environ->env->CallStaticObjectMethod(saxonCAPIClass, mIDcreateProc,sxn_environ->env->NewStringUTF(configFile));
216 216
		
217 217
	if(!proc) {
218 218
		std::cerr << "Error: SaxonDll." << "processor is NULL in constructor(configFile)"<< std::endl;
......
224 224

  
225 225
     std::cerr<<"SaxonProc constructor(configFile)"<<std::endl;
226 226
#endif
227
    xdmAtomicClass = lookForClass(environ->env, "net/sf/saxon/s9api/XdmAtomicValue");
227
    xdmAtomicClass = lookForClass(sxn_environ->env, "net/sf/saxon/s9api/XdmAtomicValue");
228 228
}
229 229

  
230 230
    SaxonProcessor::~SaxonProcessor(){
......
240 240
void SaxonProcessor::applyConfigurationProperties(){
241 241
	if(configProperties.size()>0) {
242 242
		int size = configProperties.size();
243
		jclass stringClass = lookForClass(environ->env, "java/lang/String");
244
		jobjectArray stringArray1 = environ->env->NewObjectArray( (jint)size, stringClass, 0 );
245
		jobjectArray stringArray2 = environ->env->NewObjectArray( (jint)size, stringClass, 0 );
243
		jclass stringClass = lookForClass(sxn_environ->env, "java/lang/String");
244
		jobjectArray stringArray1 = sxn_environ->env->NewObjectArray( (jint)size, stringClass, 0 );
245
		jobjectArray stringArray2 = sxn_environ->env->NewObjectArray( (jint)size, stringClass, 0 );
246 246
		static jmethodID mIDappConfig = NULL;
247 247
		if(mIDappConfig == NULL) {
248
			mIDappConfig = (jmethodID) environ->env->GetStaticMethodID(saxonCAPIClass,"applyToConfiguration",
248
			mIDappConfig = (jmethodID) sxn_environ->env->GetStaticMethodID(saxonCAPIClass,"applyToConfiguration",
249 249
					"(Lnet/sf/saxon/s9api/Processor;[Ljava/lang/String;[Ljava/lang/String;)V");
250 250
			if (!mIDappConfig) {
251 251
				std::cerr << "Error: SaxonDll." << "applyToConfiguration"
......
255 255
		}
256 256
		int i=0;
257 257
		for(map<std::string, std::string >::iterator iter=configProperties.begin(); iter!=configProperties.end(); ++iter, i++) {
258
	     		environ->env->SetObjectArrayElement( stringArray1, i, environ->env->NewStringUTF( (iter->first).c_str()  ));
259
	     		environ->env->SetObjectArrayElement( stringArray2, i, environ->env->NewStringUTF((iter->second).c_str()) );
258
	     		sxn_environ->env->SetObjectArrayElement( stringArray1, i, sxn_environ->env->NewStringUTF( (iter->first).c_str()  ));
259
	     		sxn_environ->env->SetObjectArrayElement( stringArray2, i, sxn_environ->env->NewStringUTF((iter->second).c_str()) );
260 260
	   }
261 261
		
262
		environ->env->CallStaticObjectMethod(saxonCAPIClass, mIDappConfig,proc, stringArray1,stringArray2);
262
		sxn_environ->env->CallStaticObjectMethod(saxonCAPIClass, mIDappConfig,proc, stringArray1,stringArray2);
263 263
		if (exceptionOccurred()) {
264
	   		exception= checkForExceptionCPP(environ->env, saxonCAPIClass, NULL);
264
	   		exception= checkForExceptionCPP(sxn_environ->env, saxonCAPIClass, NULL);
265 265
			exceptionClear();
266 266
      		 }
267 267
   
268
 	  environ->env->DeleteLocalRef(stringArray1);
269
	  environ->env->DeleteLocalRef(stringArray2);
268
 	  sxn_environ->env->DeleteLocalRef(stringArray1);
269
	  sxn_environ->env->DeleteLocalRef(stringArray2);
270 270
		
271 271
	}
272 272
}
......
278 278
	saxonCAPIClass = other.saxonCAPIClass;
279 279
	cwd = other.cwd;
280 280
	proc = other.proc;
281
	//environ = other.environ;
281
	//sxn_environ= other.environ;
282 282
	parameters = other.parameters;
283 283
	configProperties = other.configProperties;
284 284
	licensei = other.licensei;
......
316 316
const char * SaxonProcessor::version() {
317 317

  
318 318
     if(versionStr == NULL) {
319
     	static jmethodID MID_version = (jmethodID)environ->env->GetStaticMethodID(saxonCAPIClass, "getProductVersion", "(Lnet/sf/saxon/s9api/Processor;)Ljava/lang/String;");
319
     	static jmethodID MID_version = (jmethodID)sxn_environ->env->GetStaticMethodID(saxonCAPIClass, "getProductVersion", "(Lnet/sf/saxon/s9api/Processor;)Ljava/lang/String;");
320 320
    	if (!MID_version) {
321 321
        	std::cerr<<"\nError: MyClassInDll "<<"SaxonCAPI.getProductVersion()"<<" not found"<<std::endl;
322 322
        	return NULL;
323 323
    	}
324 324

  
325
    	jstring jstr = (jstring)(environ->env->CallStaticObjectMethod(saxonCAPIClass, MID_version, proc));
326
    	versionStr = environ->env->GetStringUTFChars(jstr, NULL);
325
    	jstring jstr = (jstring)(sxn_environ->env->CallStaticObjectMethod(saxonCAPIClass, MID_version, proc));
326
    	versionStr = sxn_environ->env->GetStringUTFChars(jstr, NULL);
327 327
    }
328 328
    return versionStr;
329 329
}
......
344 344

  
345 345
XdmNode * SaxonProcessor::parseXmlFromString(const char* source){
346 346
	
347
    jmethodID mID = (jmethodID)environ->env->GetStaticMethodID(saxonCAPIClass, "parseXmlString", "(Lnet/sf/saxon/s9api/Processor;Lnet/sf/saxon/s9api/SchemaValidator;Ljava/lang/String;)Lnet/sf/saxon/s9api/XdmNode;");
347
    jmethodID mID = (jmethodID)sxn_environ->env->GetStaticMethodID(saxonCAPIClass, "parseXmlString", "(Lnet/sf/saxon/s9api/Processor;Lnet/sf/saxon/s9api/SchemaValidator;Ljava/lang/String;)Lnet/sf/saxon/s9api/XdmNode;");
348 348
    if (!mID) {
349 349
	cerr<<"\nError: MyClassInDll "<<"parseXmlString()"<<" not found"<<endl;
350 350
        return NULL;
351 351
    }
352 352
//TODO SchemaValidator
353 353

  
354
   jobject xdmNodei = environ->env->CallStaticObjectMethod(saxonCAPIClass, mID, proc, NULL, environ->env->NewStringUTF(source));
354
   jobject xdmNodei = sxn_environ->env->CallStaticObjectMethod(saxonCAPIClass, mID, proc, NULL, sxn_environ->env->NewStringUTF(source));
355 355
	if(xdmNodei) {
356 356
		XdmNode * value = new XdmNode(xdmNodei);
357 357
		value->setProcessor(this);
358 358
		return value;
359 359
	}   else if (exceptionOccurred()) {
360
	   exception= checkForExceptionCPP(environ->env, saxonCAPIClass, NULL);
360
	   exception= checkForExceptionCPP(sxn_environ->env, saxonCAPIClass, NULL);
361 361
		exceptionClear();
362 362
       }
363 363
   
364 364
#ifdef DEBUG
365
	environ->env->ExceptionDescribe();
365
	sxn_environ->env->ExceptionDescribe();
366 366
#endif
367 367
 
368 368
   return NULL;
369 369
}
370 370

  
371 371
int SaxonProcessor::getNodeKind(jobject obj){
372
	jclass xdmNodeClass = lookForClass(environ->env, "Lnet/sf/saxon/s9api/XdmNode;");
373
	static jmethodID nodeKindMID = (jmethodID) environ->env->GetMethodID(xdmNodeClass,"getNodeKind", "()Lnet/sf/saxon/s9api/XdmNodeKind;");
372
	jclass xdmNodeClass = lookForClass(sxn_environ->env, "Lnet/sf/saxon/s9api/XdmNode;");
373
	static jmethodID nodeKindMID = (jmethodID) sxn_environ->env->GetMethodID(xdmNodeClass,"getNodeKind", "()Lnet/sf/saxon/s9api/XdmNodeKind;");
374 374
	if (!nodeKindMID) {
375 375
		cerr << "Error: MyClassInDll." << "getNodeKind" << " not found\n"
376 376
				<< endl;
377 377
		return 0;
378 378
	} 
379 379

  
380
	jobject nodeKindObj = (environ->env->CallObjectMethod(obj, nodeKindMID));
380
	jobject nodeKindObj = (sxn_environ->env->CallObjectMethod(obj, nodeKindMID));
381 381
	if(!nodeKindObj) {
382 382
		std::cout<<"saxonProc nodeKind error"<<std::endl;
383 383
		return 0;
384 384
	}
385
	jclass xdmUtilsClass = lookForClass(environ->env, "Lnet/sf/saxon/option/cpp/XdmUtils;");
385
	jclass xdmUtilsClass = lookForClass(sxn_environ->env, "Lnet/sf/saxon/option/cpp/XdmUtils;");
386 386

  
387 387

  
388
	jmethodID mID2 = (jmethodID) environ->env->GetStaticMethodID(xdmUtilsClass,"convertNodeKindType", "(Lnet/sf/saxon/s9api/XdmNodeKind;)I");
388
	jmethodID mID2 = (jmethodID) sxn_environ->env->GetStaticMethodID(xdmUtilsClass,"convertNodeKindType", "(Lnet/sf/saxon/s9api/XdmNodeKind;)I");
389 389

  
390 390
	if (!mID2) {
391 391
		cerr << "Error: MyClassInDll." << "convertNodeKindType" << " not found\n"
......
395 395
	if(!nodeKindObj){
396 396
		return 0;	
397 397
	}
398
	int nodeKind = (long)(environ->env->CallStaticObjectMethod(xdmUtilsClass, mID2, nodeKindObj));
398
	int nodeKind = (long)(sxn_environ->env->CallStaticObjectMethod(xdmUtilsClass, mID2, nodeKindObj));
399 399

  
400 400
	return nodeKind;
401 401
}
402 402

  
403 403
XdmNode * SaxonProcessor::parseXmlFromFile(const char* source){
404 404

  
405
    jmethodID mID = (jmethodID)environ->env->GetStaticMethodID(saxonCAPIClass, "parseXmlFile", "(Lnet/sf/saxon/s9api/Processor;Ljava/lang/String;Lnet/sf/saxon/s9api/SchemaValidator;Ljava/lang/String;)Lnet/sf/saxon/s9api/XdmNode;");
405
    jmethodID mID = (jmethodID)sxn_environ->env->GetStaticMethodID(saxonCAPIClass, "parseXmlFile", "(Lnet/sf/saxon/s9api/Processor;Ljava/lang/String;Lnet/sf/saxon/s9api/SchemaValidator;Ljava/lang/String;)Lnet/sf/saxon/s9api/XdmNode;");
406 406
    if (!mID) {
407 407
	cerr<<"\nError: MyClassInDll "<<"parseXmlFile()"<<" not found"<<endl;
408 408
        return NULL;
409 409
    }
410 410
//TODO SchemaValidator
411
   jobject xdmNodei = environ->env->CallStaticObjectMethod(saxonCAPIClass, mID, proc, environ->env->NewStringUTF(cwd.c_str()),  NULL, environ->env->NewStringUTF(source));
411
   jobject xdmNodei = sxn_environ->env->CallStaticObjectMethod(saxonCAPIClass, mID, proc, sxn_environ->env->NewStringUTF(cwd.c_str()),  NULL, sxn_environ->env->NewStringUTF(source));
412 412
     if(exceptionOccurred()) {
413
	   exception= checkForExceptionCPP(environ->env, saxonCAPIClass, NULL);
413
	   exception= checkForExceptionCPP(sxn_environ->env, saxonCAPIClass, NULL);
414 414
	   exceptionClear();
415 415
	   		
416 416
     } else {
......
424 424

  
425 425
XdmNode * SaxonProcessor::parseXmlFromUri(const char* source){
426 426

  
427
    jmethodID mID = (jmethodID)environ->env->GetStaticMethodID(saxonCAPIClass, "parseXmlFile", "(Lnet/sf/saxon/s9api/Processor;Ljava/lang/String;Ljava/lang/String;)Lnet/sf/saxon/s9api/XdmNode;");
427
    jmethodID mID = (jmethodID)sxn_environ->env->GetStaticMethodID(saxonCAPIClass, "parseXmlFile", "(Lnet/sf/saxon/s9api/Processor;Ljava/lang/String;Ljava/lang/String;)Lnet/sf/saxon/s9api/XdmNode;");
428 428
    if (!mID) {
429 429
	cerr<<"\nError: MyClassInDll "<<"parseXmlFromUri()"<<" not found"<<endl;
430 430
        return NULL;
431 431
    }
432
   jobject xdmNodei = environ->env->CallStaticObjectMethod(saxonCAPIClass, mID, proc, environ->env->NewStringUTF(""), environ->env->NewStringUTF(source));
432
   jobject xdmNodei = sxn_environ->env->CallStaticObjectMethod(saxonCAPIClass, mID, proc, sxn_environ->env->NewStringUTF(""), sxn_environ->env->NewStringUTF(source));
433 433
     if(exceptionOccurred()) {
434
	   exception= checkForExceptionCPP(environ->env, saxonCAPIClass, NULL);
434
	   exception= checkForExceptionCPP(sxn_environ->env, saxonCAPIClass, NULL);
435 435
     } else {
436 436
	XdmNode * value = new XdmNode(xdmNodei);
437 437
	value->setProcessor(this);
......
456 456
   }
457 457

  
458 458

  
459

  
459 460
void SaxonProcessor::release(){
460 461
	if(jvmCreatedCPP!=0) {
461 462
		jvmCreatedCPP =0;
462 463

  
463
 		finalizeJavaRT (environ->jvm);
464
 		finalizeJavaRT (sxn_environ->jvm);
464 465

  
465
		//delete environ ;
466
		//delete sxn_environ;
466 467
	/*clearParameters();
467 468
	clearProperties();*/
468 469
} else {
......
478 479
/* ========= Factory method for Xdm ======== */
479 480

  
480 481
    XdmAtomicValue * SaxonProcessor::makeStringValue(std::string str){
481
	jobject obj = getJavaStringValue(*environ, str.c_str());
482
	jmethodID mID_atomic = (jmethodID)(environ->env->GetMethodID (xdmAtomicClass, "<init>", "(Ljava/lang/String;)V"));
483
	jobject obj2 = (jobject)(environ->env->NewObject(xdmAtomicClass, mID_atomic, obj));
482
	jobject obj = getJavaStringValue(*sxn_environ, str.c_str());
483
	jmethodID mID_atomic = (jmethodID)(sxn_environ->env->GetMethodID (xdmAtomicClass, "<init>", "(Ljava/lang/String;)V"));
484
	jobject obj2 = (jobject)(sxn_environ->env->NewObject(xdmAtomicClass, mID_atomic, obj));
484 485
	XdmAtomicValue * value = new XdmAtomicValue(obj2, "xs:string");
485 486
	value->setProcessor(this);
486 487
	return value;
487 488
    }
488 489

  
489 490
    XdmAtomicValue * SaxonProcessor::makeStringValue(const char * str){
490
	jobject obj = getJavaStringValue(*environ, str);
491
	jmethodID mID_atomic = (jmethodID)(environ->env->GetMethodID (xdmAtomicClass, "<init>", "(Ljava/lang/String;)V"));
492
	jobject obj2 = (jobject)(environ->env->NewObject(xdmAtomicClass, mID_atomic, obj));
491
	jobject obj = getJavaStringValue(*sxn_environ, str);
492
	jmethodID mID_atomic = (jmethodID)(sxn_environ->env->GetMethodID (xdmAtomicClass, "<init>", "(Ljava/lang/String;)V"));
493
	jobject obj2 = (jobject)(sxn_environ->env->NewObject(xdmAtomicClass, mID_atomic, obj));
493 494
	XdmAtomicValue * value = new XdmAtomicValue(obj2, "xs:string");
494 495
	value->setProcessor(this);
495 496
	return value;
496 497
    }
497 498

  
498 499
    XdmAtomicValue * SaxonProcessor::makeIntegerValue(int i){
499
	//jobject obj = integerValue(*environ, i);
500
	jmethodID mID_atomic = (jmethodID)(environ->env->GetMethodID (xdmAtomicClass, "<init>", "(J)V"));
500
	//jobject obj = integerValue(*sxn_environ, i);
501
	jmethodID mID_atomic = (jmethodID)(sxn_environ->env->GetMethodID (xdmAtomicClass, "<init>", "(J)V"));
501 502
	
502 503

  
503
	jobject obj = (jobject)(environ->env->NewObject(xdmAtomicClass, mID_atomic, (jlong)i));
504
	jobject obj = (jobject)(sxn_environ->env->NewObject(xdmAtomicClass, mID_atomic, (jlong)i));
504 505
	XdmAtomicValue * value = new XdmAtomicValue(obj, "Q{http://www.w3.org/2001/XMLSchema}integer");
505 506
	value->setProcessor(this);
506 507
	return value;
507 508
    }
508 509

  
509 510
    XdmAtomicValue * SaxonProcessor::makeDoubleValue(double d){
510
	//jobject obj = doubleValue(*environ, d);
511
	jmethodID mID_atomic = (jmethodID)(environ->env->GetMethodID (xdmAtomicClass, "<init>", "(D)V"));
512
	jobject obj = (jobject)(environ->env->NewObject(xdmAtomicClass, mID_atomic, (jdouble)d));
511
	//jobject obj = doubleValue(*sxn_environ, d);
512
	jmethodID mID_atomic = (jmethodID)(sxn_environ->env->GetMethodID (xdmAtomicClass, "<init>", "(D)V"));
513
	jobject obj = (jobject)(sxn_environ->env->NewObject(xdmAtomicClass, mID_atomic, (jdouble)d));
513 514
	XdmAtomicValue * value = new XdmAtomicValue(obj, "Q{http://www.w3.org/2001/XMLSchema}double");
514 515
	value->setProcessor(this);
515 516
	return value;
516 517
    }
517 518

  
518 519
    XdmAtomicValue * SaxonProcessor::makeFloatValue(float d){
519
	//jobject obj = doubleValue(*environ, d);
520
	jmethodID mID_atomic = (jmethodID)(environ->env->GetMethodID (xdmAtomicClass, "<init>", "(F)V"));
521
	jobject obj = (jobject)(environ->env->NewObject(xdmAtomicClass, mID_atomic, (jfloat)d));
520
	//jobject obj = doubleValue(*sxn_environ, d);
521
	jmethodID mID_atomic = (jmethodID)(sxn_environ->env->GetMethodID (xdmAtomicClass, "<init>", "(F)V"));
522
	jobject obj = (jobject)(sxn_environ->env->NewObject(xdmAtomicClass, mID_atomic, (jfloat)d));
522 523
	XdmAtomicValue * value = new XdmAtomicValue(obj, "Q{http://www.w3.org/2001/XMLSchema}float");
523 524
	value->setProcessor(this);
524 525
	return value;
525 526
    }
526 527

  
527 528
    XdmAtomicValue * SaxonProcessor::makeLongValue(long l){
528
	//jobject obj = longValue(*environ, l);
529
	jmethodID mID_atomic = (jmethodID)(environ->env->GetMethodID (xdmAtomicClass, "<init>", "(J)V"));
530
	jobject obj = (jobject)(environ->env->NewObject(xdmAtomicClass, mID_atomic, (jlong)l));
529
	//jobject obj = longValue(*sxn_environ, l);
530
	jmethodID mID_atomic = (jmethodID)(sxn_environ->env->GetMethodID (xdmAtomicClass, "<init>", "(J)V"));
531
	jobject obj = (jobject)(sxn_environ->env->NewObject(xdmAtomicClass, mID_atomic, (jlong)l));
531 532
	XdmAtomicValue * value = new XdmAtomicValue(obj, "Q{http://www.w3.org/2001/XMLSchema}long");
532 533
	value->setProcessor(this);
533 534
	return value;
534 535
    }
535 536

  
536 537
    XdmAtomicValue * SaxonProcessor::makeBooleanValue(bool b){
537
	//jobject obj = booleanValue(*environ, b);
538
	jmethodID mID_atomic = (jmethodID)(environ->env->GetMethodID (xdmAtomicClass, "<init>", "(Z)V"));
539
	jobject obj = (jobject)(environ->env->NewObject(xdmAtomicClass, mID_atomic, (jboolean)b));
538
	//jobject obj = booleanValue(*sxn_environ, b);
539
	jmethodID mID_atomic = (jmethodID)(sxn_environ->env->GetMethodID (xdmAtomicClass, "<init>", "(Z)V"));
540
	jobject obj = (jobject)(sxn_environ->env->NewObject(xdmAtomicClass, mID_atomic, (jboolean)b));
540 541
	XdmAtomicValue * value = new XdmAtomicValue(obj, "Q{http://www.w3.org/2001/XMLSchema}boolean");
541 542
	value->setProcessor(this);
542 543
	return value;
543 544
    }
544 545

  
545 546
    XdmAtomicValue * SaxonProcessor::makeQNameValue(std::string str){
546
	jobject val = xdmValueAsObj(*environ, "QName", str.c_str());
547
	jobject val = xdmValueAsObj(*sxn_environ, "QName", str.c_str());
547 548
	XdmAtomicValue * value = new XdmAtomicValue(val, "QName");
548 549
	value->setProcessor(this);
549 550
	return value;
550 551
    }
551 552

  
552 553
    XdmAtomicValue * SaxonProcessor::makeAtomicValue(std::string typei, std::string strValue){
553
	jobject obj = xdmValueAsObj(*environ, typei.c_str(), strValue.c_str());
554
	jobject obj = xdmValueAsObj(*sxn_environ, typei.c_str(), strValue.c_str());
554 555
	XdmAtomicValue * value = new XdmAtomicValue(obj, typei);
555 556
	value->setProcessor(this);
556 557
	return value;
557 558
    }
558 559

  
559 560
    const char * SaxonProcessor::getStringValue(XdmItem * item){
560
	const char *result = stringValue(*environ, item->getUnderlyingValue(this));
561
	const char *result = stringValue(*sxn_environ, item->getUnderlyingValue(this));
561 562
#ifdef DEBUG
562 563
	if(result == NULL) {
563 564
		std::cout<<"getStringValue of XdmItem is NULL"<<std::endl;

Also available in: Unified diff