Project

Profile

Help

Revision 5401a5ae

Added by O'Neil Delpratt almost 2 years ago

Saxon/C Development

View differences:

latest9.9/hec/Saxon.C.API/XsltProcessor.cpp
39 39
#endif
40 40
	nodeCreated = false;
41 41
    jitCompilation = false;
42
	proc->exception = NULL;
42
	exception = NULL;
43 43
	if(!(proc->cwd.empty()) && curr.empty()){
44 44
		cwdXT = proc->cwd;
45 45
	} else {
......
61 61

  
62 62
       XdmValue * valuei = paramIter->second;
63 63
       if(valuei == NULL) {
64
    	 	cerr<<"Error in XsltProcessor copy constructor"<<endl;
64
    	 	//std::cerr<<"Error in XsltProcessor copy constructor"<<std::endl;
65 65
       } else {
66 66
            parameters[paramIter->first] = new XdmValue(*(valuei));
67 67
       }
......
88 88
	return proc->exceptionOccurred();
89 89
}
90 90

  
91
const char * XsltProcessor::getErrorCode(int i) {
92
 if(proc->exception == NULL) {return NULL;}
93
 return proc->exception->getErrorCode(i);
91
const char * XsltProcessor::getErrorCode() {
92
 if(exception == NULL) {
93
    return NULL;
94 94
 }
95
 return exception->getErrorCode();
96
}
95 97

  
96 98
void XsltProcessor::setSourceFromXdmNode(XdmNode * value) {
97 99
    if(value != NULL){
......
120 122
	if(value != NULL && name != NULL){
121 123
		value->incrementRefCount();
122 124
		int s = parameters.size();
123
		std::String skey = "param:"+std::string(name);
125
		std::string skey = "param:"+std::string(name);
124 126
		parameters[skey] = value;
125 127
		if(s == parameters.size()) {
126 128
            std::map<std::string, XdmValue*>::iterator it;
......
157 159
void XsltProcessor::setProperty(const char* name, const char* value) {	
158 160
	if(name != NULL) {
159 161
	    int s = properties.size();
160
		std:string skey = std::string(name);
162
		std::string skey = std::string(name);
161 163
		properties.insert(std::pair<std::string, std::string>(skey, std::string((value == NULL ? "" : value))));
162 164

  
163 165
		if(s == properties.size()) {
......
222 224
}
223 225

  
224 226
void XsltProcessor::exceptionClear(){
225
 if(proc->exception != NULL) {
226
 	delete proc->exception;
227
 	proc->exception = NULL;
227
 if(exception != NULL) {
228
 	delete exception;
229
 	exception = NULL;
228 230
	SaxonProcessor::sxn_environ->env->ExceptionClear();
229 231
 }
230 232
  
......
244 246
	return proc->checkException(cppXT);
245 247
}
246 248

  
247
int XsltProcessor::exceptionCount(){
248
 if(proc->exception != NULL){
249
 return proc->exception->count();
250
 }
251
 return 0;
252
 }
253

  
254 249

  
255 250
    void XsltProcessor::compileFromXdmNodeAndSave(XdmNode * node, const char* filename) {
256 251
	static jmethodID cAndSNodemID =
......
268 263
						SaxonProcessor::sxn_environ->env->NewStringUTF(cwdXT.c_str()),
269 264
						node->getUnderlyingValue(), 							SaxonProcessor::sxn_environ->env->NewStringUTF(filename));
270 265
		
271
		proc->checkAndCreateException(cppClass);		
266
		exception = proc->checkAndCreateException(cppClass);
272 267

  
273 268
    }
274 269

  
......
292 287
						SaxonProcessor::sxn_environ->env->NewStringUTF(cwdXT.c_str()),
293 288
						SaxonProcessor::sxn_environ->env->NewStringUTF(stylesheetStr), 							SaxonProcessor::sxn_environ->env->NewStringUTF(filename));
294 289
		
295
		proc->checkAndCreateException(cppClass);		
290
		exception = proc->checkAndCreateException(cppClass);
296 291

  
297 292
    }
298 293
}
......
315 310
						SaxonProcessor::sxn_environ->env->NewStringUTF(cwdXT.c_str()),
316 311
						SaxonProcessor::sxn_environ->env->NewStringUTF(xslFilename),SaxonProcessor::sxn_environ->env->NewStringUTF(filename));
317 312
		
318
		proc->checkAndCreateException(cppClass);
313
		exception = proc->checkAndCreateException(cppClass);
319 314

  
320 315

  
321 316
     }
......
342 337
						SaxonProcessor::sxn_environ->env->NewStringUTF(cwdXT.c_str()),
343 338
						SaxonProcessor::sxn_environ->env->NewStringUTF(stylesheetStr)));
344 339
		if (!stylesheetObject) {
345
			proc->checkAndCreateException(cppClass);
340
			exception = proc->checkAndCreateException(cppClass);
346 341
		}
347 342
	}
348 343

  
......
369 364
						SaxonProcessor::sxn_environ->env->NewStringUTF(cwdXT.c_str()),
370 365
						node->getUnderlyingValue()));
371 366
		if (!stylesheetObject) {
372
			proc->checkAndCreateException(cppClass);
367
			exception = proc->checkAndCreateException(cppClass);
373 368
			//cout << "Error in compileFromXdmNode" << endl;
374 369
		}
375 370
	}
......
393 388
						SaxonProcessor::sxn_environ->env->NewStringUTF(cwdXT.c_str()),
394 389
						SaxonProcessor::sxn_environ->env->NewStringUTF(stylesheet)));
395 390
		if (!stylesheetObject) {
396
			proc->checkAndCreateException(cppClass);
391
			exception = proc->checkAndCreateException(cppClass);
397 392
     		
398 393
		}
399 394
		//SaxonProcessor::sxn_environ->env->NewGlobalRef(stylesheetObject);
......
487 482
			return value;
488 483
		}else {
489 484
	
490
			proc->checkAndCreateException(cppClass);
485
			exception = proc->checkAndCreateException(cppClass);
491 486
	   		
492 487
     		}
493 488
	}
......
595 590
	proc->checkAndCreateException(cppClass);
596 591
}
597 592

  
598
void XsltProcessor::setupXslMessage(bool show, const char* filename=NULL) {
593
void XsltProcessor::setupXslMessage(bool show, const char* filename) {
599 594
    if(show) {
600 595
        if(filename == NULL) {
601 596
            setProperty("m", "on");
602 597
        } else {
603
            setProperty("m", std::string(filename));
598
            setProperty("m", filename);
604 599
        }
605 600
    } else {
606 601
        setProperty("m", "off");
......
716 711
			SaxonProcessor::sxn_environ->env->DeleteLocalRef(obj);
717 712
			return str;
718 713
		} else  {
719
			proc->checkAndCreateException(cppClass);  
714
			exception = proc->checkAndCreateException(cppClass);
720 715
	   		
721 716
     		}
722 717
	}
......
749 744
	transformFileToFile(NULL, NULL, NULL);
750 745
   }
751 746

  
752
const char * XsltProcessor::getErrorMessage(int i ){
753
 	if(proc->exception == NULL) {return NULL;}
754
 		return proc->exception->getErrorMessage(i);
747
const char * XsltProcessor::getErrorMessage(){
748
 	if(exception == NULL) {
749
 	    return NULL;
750
 	}
751
 	return exception->getErrorMessage();
755 752
 }
756 753

  

Also available in: Unified diff