Return-Path: Mailing-List: contact general-help@xml.apache.org; run by ezmlm Delivered-To: mailing list general@xml.apache.org Received: (qmail 73312 invoked from network); 4 Jan 2001 18:17:12 -0000 Received: from adsl-216-62-177-178.dsl.hstntx.swbell.net (HELO jupiter2.lincom-asg.com) (216.62.177.178) by h31.sny.collab.net with SMTP; 4 Jan 2001 18:17:12 -0000 Received: from lincom-asg.com ([206.109.111.108]) by jupiter2.lincom-asg.com (8.9.3/8.8.7) with ESMTP id NAA01567 for ; Thu, 4 Jan 2001 13:25:47 -0600 (CST) (envelope-from rjamison@lincom-asg.com) Message-ID: <3A54BE7F.5060403@lincom-asg.com> Date: Thu, 04 Jan 2001 12:18:39 -0600 From: Bob Jamison User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; m18) Gecko/20001231 X-Accept-Language: en MIME-Version: 1.0 To: general@xml.apache.org Subject: Re: Using Xalan with Apache References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N ?? wrote: > Current version of Xalan-C++ was implemented using C++. > Thus, it is impossible to use it in Apache web server, I think. > Maybe there might be someway to port the C++ version to C, > but I think it would be so painful job. It's really no problem. Just make a few C wrapper functions around the C++ calls in a .cpp file, and have the corresponding .h prototype file be C-only. Here is a Xerces example, Xalan should work the same. Have a file called parser.cpp: #include "parser.h" class MySaxHandler : public DefaultHandler { //overload the methods } int parseMyFile(char *fileName,struct SomethingToBeFilled *dest) { try { XMLPlatformUtils::Initialize(); SAX2XMLReader* parser = XMLReaderFactory::createXMLReader(); MySaxHandler handler; handler.setOutputStruct(dest); parser->setContentHandler(&handler); parser->setErrorHandler(&handler); parser->parse(fileName); XMLPlatformUtils::Terminate(); } catch (const XMLException &e) { //error messages return 0; } return 1; } in parser.h: #ifdef __cplusplus extern "C" { #endif __cplusplus int parseMyFile(char *fileName,struct SomeThingToBeFilled *dest); #ifdef __cplusplus } #endif __cplusplus The 'extern C' declaration will prevent the function name from being mangled, so it can be called from a module's C code. Bob Jamison LinCom Corp