hi again Dave!
thx for your tips! then , what i need is to build my jni bridge in c++, isnt
it?
i wrote a preliminar c++ app:
//
// File: es_yell_frontlite_servlets_ContenedorRecursivoWidgets.h
// Author: alonso
//
// Created on 30 de enero de 2008, 12:02
//
#ifndef _ES_YELL_FRONTLITE_SERVLETS_CONTENEDORRECURSIVOWIDGETS_H
#define _ES_YELL_FRONTLITE_SERVLETS_CONTENEDORRECURSIVOWIDGETS_H
#include <jni.h>
#include <xercesc/util/PlatformUtils.hpp>
#include <xalanc/XalanTransformer/XalanTransformer.hpp>
#include <stdio.h>
#include <iostream.h>
#include <strstream>
XALAN_USING_STD(cout);
XALAN_USING_STD(endl);
XALAN_USING_STD(cerr);
XALAN_USING_XERCES(XMLPlatformUtils)
XALAN_USING_XERCES(XMLException)
XALAN_USING_XALAN(XalanTransformer)
XALAN_USING_XALAN(XalanCompiledStylesheet)
XALAN_USING_XALAN(XSLTInputSource)
XALAN_USING_STD(istrstream)
typedef XalanTransformer tXalanTransformer;
class XalanCpp_Engine{
private :
tXalanTransformer theXalanTransformer;
/*
* Class: es_yell_frontlite_servlets_ContenedorRecursivoWidgets
* Method: generarTransletConXalanC
* Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;
*/
public:
JNIEXPORT jobject JNICALL
Java_es_yell_frontlite_servlets_ContenedorRecursivoWidgets_generarTransletConXalanC
(JNIEnv *pEnv, jobject pObj, jstring rutaRelativaFicheroXSL, jstring
xsl);
};
#endif /* _ES_YELL_FRONTLITE_SERVLETS_CONTENEDORRECURSIVOWIDGETS_H */
this is implementation file:
#include
"../XalanCpp_Engine/es_yell_frontlite_servlets_ContenedorRecursivoWidgets.h"
XalanCpp_Engine::JNIEXPORT jobject JNICALL
Java_es_yell_frontlite_servlets_ContenedorRecursivoWidgets_generarTransletConXalanC
(JNIEnv *pEnv, jobject pObj, jstring rutaRelativaFicheroXSL, jstring xsl){
cout<<"-->creando translet "<<rutaRelativaFicheroXSL<<endl;
static XalanTransformer theXalanTransformer;
const XalanCompiledStylesheet *compiledStylesheet = 0;
int theResult =0;
jboolean copy = JNI_FALSE;
const char *theStylesheet = env->GetStringUTFChars(xsl, ©);
if (theStylesheet == NULL) {
return NULL; // Could be out of memory
}
cout<<"xsl: "<<theStylesheet<<endl;
// Call the static initializer for Xerces.
try
{
XMLPlatformUtils::Initialize();
}
catch (const XMLException& toCatch)
{
cerr << "Error during Xerces initialization. Error code was "
<< toCatch.getCode()
<< "."
<< endl;
theResult = -1;
}
if ( theResult == 0)
{
// Initialize Xalan.
XalanTransformer::initialize();
// Create a XalanTransformer.
istrstream str(theStylesheet, strlen(theStylesheet));
const XSLTInputSource msgToTransform(&str);
int theResult = theXalanTransformer
.compileStylesheet(msgToTransform,compiledStylesheet);
}
if(theResult != 0)
{
cerr << "CompileStylesheet Error: " <<
theXalanTransformer.getLastError()
<< endl
<< endl;
}
return (jobject) compiledStylesheet;
//return NULL;
}
Unfortunately it doesnt compile, its giving me this error:
es_yell_frontlite_servlets_ContenedorRecursivoWidgets.cc:3: error: ‘jobject’
en la clase ‘XalanCpp_Engine’ no nombra a un tipo
wich translated to english :
error: jobject in class XalanCpp_Engine does not name a type
what do i m doing wrong? Am I directed well? The purpose of all that is to
be able to invoke from my java program this logic, that is to say, that this
method returns to me a precompiled translet and to be able to save this
object in a hashMap structure of my java application.
sorry for my poor english.
pls, help me!
--
View this message in context:
http://www.nabble.com/building-a-jni-bridge-between-java-and-xalan-c-tp15039293p15181009.html
Sent from the Xalan - C - Users mailing list archive at Nabble.com.