Project

Profile

Help

Revision 4e3fba42

Added by O'Neil Delpratt over 5 years ago

Saxon/C bug fix relating to static sxn_environ

View differences:

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

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

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

  
39 39
void SaxonProcessor::exceptionClear(){
40
	sxn_environ->env->ExceptionClear();
40
	SaxonProcessor::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
    sxn_environ= new sxnc_environment;//(sxnc_environment *)malloc(sizeof(sxnc_environment));
144
    SaxonProcessor::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
    sxn_environ->myDllHandle = loadDefaultDll ();
152
    SaxonProcessor::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 (&sxn_environ); 
158
    initDefaultJavaRT (&SaxonProcessor::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(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");
167
    versionClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/Version");
168
    procClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/Processor");
169
    saxonCAPIClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/option/cpp/SaxonCAPI");
170 170
    
171
    proc = createSaxonProcessor (sxn_environ->env, procClass, "(Z)V", NULL, licensei);
171
    proc = createSaxonProcessor (SaxonProcessor::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(sxn_environ->env, "net/sf/saxon/s9api/XdmAtomicValue");
176
    xdmAtomicClass = lookForClass(SaxonProcessor::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
    //sxn_environ= new sxnc_environment;
187
	sxn_environ= (sxnc_environment *)malloc(sizeof(sxnc_environment));
186
    //SaxonProcessor::sxn_environ= new sxnc_environment;
187
	SaxonProcessor::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
    sxn_environ->myDllHandle = loadDefaultDll ();
194
    SaxonProcessor::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 (&sxn_environ); 
200
    initDefaultJavaRT (&SaxonProcessor::sxn_environ); 
201 201
    }
202 202
 
203
    versionClass = lookForClass(sxn_environ->env, "net/sf/saxon/Version");
203
    versionClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/Version");
204 204

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

  
208
     static jmethodID mIDcreateProc = (jmethodID)sxn_environ->env->GetStaticMethodID(saxonCAPIClass,"createSaxonProcessor",
208
     static jmethodID mIDcreateProc = (jmethodID)SaxonProcessor::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 = sxn_environ->env->CallStaticObjectMethod(saxonCAPIClass, mIDcreateProc,sxn_environ->env->NewStringUTF(configFile));
215
	proc = SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(saxonCAPIClass, mIDcreateProc,SaxonProcessor::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(sxn_environ->env, "net/sf/saxon/s9api/XdmAtomicValue");
227
    xdmAtomicClass = lookForClass(SaxonProcessor::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(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 );
243
		jclass stringClass = lookForClass(SaxonProcessor::sxn_environ->env, "java/lang/String");
244
		jobjectArray stringArray1 = SaxonProcessor::sxn_environ->env->NewObjectArray( (jint)size, stringClass, 0 );
245
		jobjectArray stringArray2 = SaxonProcessor::sxn_environ->env->NewObjectArray( (jint)size, stringClass, 0 );
246 246
		static jmethodID mIDappConfig = NULL;
247 247
		if(mIDappConfig == NULL) {
248
			mIDappConfig = (jmethodID) sxn_environ->env->GetStaticMethodID(saxonCAPIClass,"applyToConfiguration",
248
			mIDappConfig = (jmethodID) SaxonProcessor::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
	     		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()) );
258
	     		SaxonProcessor::sxn_environ->env->SetObjectArrayElement( stringArray1, i, SaxonProcessor::sxn_environ->env->NewStringUTF( (iter->first).c_str()  ));
259
	     		SaxonProcessor::sxn_environ->env->SetObjectArrayElement( stringArray2, i, SaxonProcessor::sxn_environ->env->NewStringUTF((iter->second).c_str()) );
260 260
	   }
261 261
		
262
		sxn_environ->env->CallStaticObjectMethod(saxonCAPIClass, mIDappConfig,proc, stringArray1,stringArray2);
262
		SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(saxonCAPIClass, mIDappConfig,proc, stringArray1,stringArray2);
263 263
		if (exceptionOccurred()) {
264
	   		exception= checkForExceptionCPP(sxn_environ->env, saxonCAPIClass, NULL);
264
	   		exception= checkForExceptionCPP(SaxonProcessor::sxn_environ->env, saxonCAPIClass, NULL);
265 265
			exceptionClear();
266 266
      		 }
267 267
   
268
 	  sxn_environ->env->DeleteLocalRef(stringArray1);
269
	  sxn_environ->env->DeleteLocalRef(stringArray2);
268
 	  SaxonProcessor::sxn_environ->env->DeleteLocalRef(stringArray1);
269
	  SaxonProcessor::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
	//sxn_environ= other.environ;
281
	//SaxonProcessor::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)sxn_environ->env->GetStaticMethodID(saxonCAPIClass, "getProductVersion", "(Lnet/sf/saxon/s9api/Processor;)Ljava/lang/String;");
319
     	static jmethodID MID_version = (jmethodID)SaxonProcessor::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)(sxn_environ->env->CallStaticObjectMethod(saxonCAPIClass, MID_version, proc));
326
    	versionStr = sxn_environ->env->GetStringUTFChars(jstr, NULL);
325
    	jstring jstr = (jstring)(SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(saxonCAPIClass, MID_version, proc));
326
    	versionStr = SaxonProcessor::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)sxn_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)SaxonProcessor::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 = sxn_environ->env->CallStaticObjectMethod(saxonCAPIClass, mID, proc, NULL, sxn_environ->env->NewStringUTF(source));
354
   jobject xdmNodei = SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(saxonCAPIClass, mID, proc, NULL, SaxonProcessor::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(sxn_environ->env, saxonCAPIClass, NULL);
360
	   exception= checkForExceptionCPP(SaxonProcessor::sxn_environ->env, saxonCAPIClass, NULL);
361 361
		exceptionClear();
362 362
       }
363 363
   
364 364
#ifdef DEBUG
365
	sxn_environ->env->ExceptionDescribe();
365
	SaxonProcessor::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(sxn_environ->env, "Lnet/sf/saxon/s9api/XdmNode;");
373
	static jmethodID nodeKindMID = (jmethodID) sxn_environ->env->GetMethodID(xdmNodeClass,"getNodeKind", "()Lnet/sf/saxon/s9api/XdmNodeKind;");
372
	jclass xdmNodeClass = lookForClass(SaxonProcessor::sxn_environ->env, "Lnet/sf/saxon/s9api/XdmNode;");
373
	static jmethodID nodeKindMID = (jmethodID) SaxonProcessor::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 = (sxn_environ->env->CallObjectMethod(obj, nodeKindMID));
380
	jobject nodeKindObj = (SaxonProcessor::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(sxn_environ->env, "Lnet/sf/saxon/option/cpp/XdmUtils;");
385
	jclass xdmUtilsClass = lookForClass(SaxonProcessor::sxn_environ->env, "Lnet/sf/saxon/option/cpp/XdmUtils;");
386 386

  
387 387

  
388
	jmethodID mID2 = (jmethodID) sxn_environ->env->GetStaticMethodID(xdmUtilsClass,"convertNodeKindType", "(Lnet/sf/saxon/s9api/XdmNodeKind;)I");
388
	jmethodID mID2 = (jmethodID) SaxonProcessor::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)(sxn_environ->env->CallStaticObjectMethod(xdmUtilsClass, mID2, nodeKindObj));
398
	int nodeKind = (long)(SaxonProcessor::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)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;");
405
    jmethodID mID = (jmethodID)SaxonProcessor::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 = sxn_environ->env->CallStaticObjectMethod(saxonCAPIClass, mID, proc, sxn_environ->env->NewStringUTF(cwd.c_str()),  NULL, sxn_environ->env->NewStringUTF(source));
411
   jobject xdmNodei = SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(saxonCAPIClass, mID, proc, SaxonProcessor::sxn_environ->env->NewStringUTF(cwd.c_str()),  NULL, SaxonProcessor::sxn_environ->env->NewStringUTF(source));
412 412
     if(exceptionOccurred()) {
413
	   exception= checkForExceptionCPP(sxn_environ->env, saxonCAPIClass, NULL);
413
	   exception= checkForExceptionCPP(SaxonProcessor::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)sxn_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)SaxonProcessor::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 = sxn_environ->env->CallStaticObjectMethod(saxonCAPIClass, mID, proc, sxn_environ->env->NewStringUTF(""), sxn_environ->env->NewStringUTF(source));
432
   jobject xdmNodei = SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(saxonCAPIClass, mID, proc, SaxonProcessor::sxn_environ->env->NewStringUTF(""), SaxonProcessor::sxn_environ->env->NewStringUTF(source));
433 433
     if(exceptionOccurred()) {
434
	   exception= checkForExceptionCPP(sxn_environ->env, saxonCAPIClass, NULL);
434
	   exception= checkForExceptionCPP(SaxonProcessor::sxn_environ->env, saxonCAPIClass, NULL);
435 435
     } else {
436 436
	XdmNode * value = new XdmNode(xdmNodei);
437 437
	value->setProcessor(this);
......
461 461
	if(jvmCreatedCPP!=0) {
462 462
		jvmCreatedCPP =0;
463 463

  
464
 		finalizeJavaRT (sxn_environ->jvm);
464
 		finalizeJavaRT (SaxonProcessor::sxn_environ->jvm);
465 465

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

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

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

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

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

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

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

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

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

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

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

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

Also available in: Unified diff