[xsl] problem encounter whilst intergating the xalan API

Subject: [xsl] problem encounter whilst intergating the xalan API
From: "林 子芯" <minikittygo@xxxxxxxxxxx>
Date: Thu, 24 Jan 2002 12:17:14 +0000
Hi,
I was wandering whether had a similiar problem of integating the c++ API of xalan into your own program... at present i am using xalan C++ ver. 1.3 for my own application, following what is written on the usage pattern in the website (http://xml.apache.org/xalan-c/usagepatterns.html#xalantransformer). it managed to complied and intergrated into my program.
however, there are few problem occurs... it seems during run time, if i was trying to call this function (or choose this option in my application) more than once it will crash my program instantly. i have tried and take the XMLPlatformUtils::Terminate() out of the program, yes this allows me to call the function more than once but further problem developes as it will crash randomly.


Here are the code of my application...

The function for xslt transformation

void xml_output_conversion()
{
	XMLPlatformUtils::Initialize();
	XalanTransformer::initialize();

XalanTransformer theXalanTransformer;

	XSLTInputSource xmlIn("Results/results.xml");
	XSLTInputSource xslIn ("xsltres2.xsl");
	XSLTResultTarget xmlOut ("Results/results.html");

int TheResulT= theXalanTransformer.transform(xmlIn, xslIn, xmlOut);

    XMLPlatformUtils::Terminate();
	/*XalanTransformer::terminate() is responisble Terminate Xalan*/
	 XalanTransformer::terminate();



  return;
}

and the function responsible of calling this above function that lies in my main program...

void opt_xml_to_html()
{
xml_output_conversion();
   cerr << "Files are created, please go and look it up in the Results
Directory\n";

return;
}

i have tried and move XMLPlatformUtils::Initialize() and XalanTransformer::initialize()
to the beginning of the main function {the start of main () }, and move the XMLPlatformUtils::Terminate() and XalanTransformer::terminate() to the end of the main function. however, i am still getting the same problem. I have also try and move those call into opt_xml_to_html() (see previous question)but that also not working, whilst i was trying to debug it it tells me that access violation in my execute file (NTDLL.Dll, XSLT.DLL).


i was wandering whether there is a fault with the way I have written the
application or something, i will be grateful if someone will be kind enough to help me out
Many Thanks


Kit

P.S.1 i am developing my application in MSVC++ 6 with ServicePack 5, would that cause any problem?
P.S.2 apologise to David Bertoni, to whom i cause so much inconvience to.


_________________________________________________________________
使用 MSN Messenger 與朋友在線上聊天:http://messenger.microsoft.com/tc。;


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread