You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by David Vos <dv...@cs.purdue.edu> on 2003/01/08 21:48:06 UTC
Xalan in Apache 2.0 module
I'm working on an Apache 2.0 module that performs xslt. I would like to
use Xalan C++ if possible, though I am open to using other libraries if
necessary.
I've gotten Xalan C++ to work under Apache 1.3. Now, when I'm porting the
module to Apache 2.0, it crashes when I call transform().
Does anyone have any simple, bare-bones examples of Apache 2.0 modules
that use Xalan C++?
I also found in the archives a mention that Xalan has a C API. Could
someone give me a reference for it? I only need to do a simple
transformation using xslt parameters. (Preferrably using a Xalan output
handler so that I can send the result to the client). Apache might like
it better if I do the whole project in C instead of C++.
Here is an example function that I can call from my apache handler:
void test() {
XMLPlatformUtils::Initialize();
XalanTransformer::initialize();
XalanTransformer theXalanTransformer;
int theResult = theXalanTransformer.transform("/tmp/foo.xml",
"/tmp/foo.xsl", "/tmp/foo.out");
if(theResult != 0) {
cerr << "UseStylesheetParam Error: \n" <<
theXalanTransformer.getLastError() << endl << endl;
}
XalanTransformer::terminate();
XMLPlatformUtils::Terminate();
XalanTransformer::ICUCleanUp();
}
The apache process will segfault on transform().
David
Re: Xalan in Apache 2.0 module
Posted by David Vos <dv...@cs.purdue.edu>.
On Thu, 16 Jan 2003, Juergen Hermann wrote:
> You have to have any created objects in their own scope, so they are
> destroyed BEFORE the terminate calls!
It makes sense, but I sure wouldn't have thought of that. Thanks!
David
Re: Xalan in Apache 2.0 module
Posted by Juergen Hermann <jh...@web.de>.
On Wed, 8 Jan 2003 15:48:06 -0500 (EST), David Vos wrote:
>void test() {
> XMLPlatformUtils::Initialize();
> XalanTransformer::initialize();
{
> XalanTransformer theXalanTransformer;
> int theResult = theXalanTransformer.transform("/tmp/foo.xml",
> "/tmp/foo.xsl", "/tmp/foo.out");
> if(theResult != 0) {
> cerr << "UseStylesheetParam Error: \n" <<
>theXalanTransformer.getLastError() << endl << endl;
> }
>
}
> XalanTransformer::terminate();
> XMLPlatformUtils::Terminate();
> XalanTransformer::ICUCleanUp();
>}
You have to have any created objects in their own scope, so they are
destroyed BEFORE the terminate calls!
Ciao, Jürgen
Re: Xalan in Apache 2.0 module
Posted by David N Bertoni/Cambridge/IBM <da...@us.ibm.com>.
Hi David,
You can use the callback interface. Look at the ApacheModuleXSLT sample
again, because that's what it uses. You can just pass in a FILE* instead
of a pointer to the Apache struct.
Dave
David Vos
<dvos@cs.purdue. To: David N Bertoni/Cambridge/IBM <da...@us.ibm.com>
edu> cc: <xa...@xml.apache.org>
Subject: Re: Xalan in Apache 2.0 module
01/09/2003 01:35
PM
On Wed, 8 Jan 2003, David N Bertoni/Cambridge/IBM wrote:
> There's an existing sample application that uses the C API for
> transformations. See the ApacheModuleXSLT sample application for more
> information. The C API is documented here:
>
> http://xml.apache.org/xalan-c/apidocs/XalanCAPI.h.html
Thanks! Is there any way to send the output of the transformation to a
file handle instead of a file name?
David
Re: Xalan in Apache 2.0 module
Posted by David Vos <dv...@cs.purdue.edu>.
On Wed, 8 Jan 2003, David N Bertoni/Cambridge/IBM wrote:
> There's an existing sample application that uses the C API for
> transformations. See the ApacheModuleXSLT sample application for more
> information. The C API is documented here:
>
> http://xml.apache.org/xalan-c/apidocs/XalanCAPI.h.html
Thanks! Is there any way to send the output of the transformation to a
file handle instead of a file name?
David
Re: Xalan in Apache 2.0 module
Posted by David N Bertoni/Cambridge/IBM <da...@us.ibm.com>.
Hi David,
There's an existing sample application that uses the C API for
transformations. See the ApacheModuleXSLT sample application for more
information. The C API is documented here:
http://xml.apache.org/xalan-c/apidocs/XalanCAPI.h.html
I'm not sure why a transformation would be crashing inside Apache that
works find outside of it, or why it works in 1.3, but not in 2.0. It could
be related to exception handling, so you might want to look through the
Apache documentation to see what it says about integrating C++ code which
uses exceptions.
Dave
David Vos
<dvos@cs.purdue. To: <xa...@xml.apache.org>
edu> cc: (bcc: David N Bertoni/Cambridge/IBM)
Subject: Xalan in Apache 2.0 module
01/08/2003 12:48
PM
I'm working on an Apache 2.0 module that performs xslt. I would like to
use Xalan C++ if possible, though I am open to using other libraries if
necessary.
I've gotten Xalan C++ to work under Apache 1.3. Now, when I'm porting the
module to Apache 2.0, it crashes when I call transform().
Does anyone have any simple, bare-bones examples of Apache 2.0 modules
that use Xalan C++?
I also found in the archives a mention that Xalan has a C API. Could
someone give me a reference for it? I only need to do a simple
transformation using xslt parameters. (Preferrably using a Xalan output
handler so that I can send the result to the client). Apache might like
it better if I do the whole project in C instead of C++.
Here is an example function that I can call from my apache handler:
void test() {
XMLPlatformUtils::Initialize();
XalanTransformer::initialize();
XalanTransformer theXalanTransformer;
int theResult = theXalanTransformer.transform("/tmp/foo.xml",
"/tmp/foo.xsl", "/tmp/foo.out");
if(theResult != 0) {
cerr << "UseStylesheetParam Error: \n" <<
theXalanTransformer.getLastError() << endl << endl;
}
XalanTransformer::terminate();
XMLPlatformUtils::Terminate();
XalanTransformer::ICUCleanUp();
}
The apache process will segfault on transform().
David