logancillo wrote:
hi Dave, i solved the problem with first compilation error, an include was
absent!
now its giving me more errors, hope you can help me!
this is original error message, in spanish:
WraperXalanC.h:41: error: tipo abstracto de devolución inválido para la
función miembro ‘XalanCompiledStylesheet WraperXalanC::crearTranslet(char*)’
translation : invalid abstract return
XalanCompiledStylesheet is an abstract base class, and you cannot return it
by value. You will need to return a pointer or reference to a class that
implements the class.
/usr/local/include/xalanc/XalanTransformer/XalanCompiledStylesheet.hpp:39:
nota: porque las siguientes funciones virtual son puras en
‘XalanCompiledStylesheet’: translation: Because the following virtual
functions are pure
/usr/local/include/xalanc/XalanTransformer/XalanCompiledStylesheet.hpp:46:
nota: virtual const xalanc_1_10::StylesheetRoot*
xalanc_1_10::XalanCompiledStylesheet::getStylesheetRoot() const
WraperXalanC.h:43: error: no se puede declarar que el parámetro
‘plantillaXsl’ sea del tipo abstracto ‘XalanCompiledStylesheet’
/usr/local/include/xalanc/XalanTransformer/XalanCompiledStylesheet.hpp:39:
nota: ya que el tipo ‘XalanCompiledStylesheet’ tiene funciones virtuales
puras
make[1]: *** [build/Debug/GNU-Linux-x86/newmain.o] Error 1
make[1]: se sale del directorio `/home/alonso/curro/pruebaXalanC'
make: *** [.build-impl] Error 2
Build failed. Exit value 2.
I need that method XalanCompiledStylesheet WraperXalanC::crearTranslet(char
*cadena) returns the compiled stylesheet in order that the method could be
invoked from my java program across jni, that is to say, I need a method
that given a chain of characters returns me the precompiled object in order
that I could save it in a hashmap java object and could be invoked at any
time. I dont know if its possible
Please read the documentation of the APIs very carefully, as the code
you've written has a number of problems. For example, the documentation
for XalanTransformer::compileStylesheet says:
/**
* Creates a compiled stylesheet. The input source can be
* a file name, a stream or a root node. The XalanTransformer
* instance owns the XalanCompiledStylesheet instance and will
* delete it when the XalanTransformer instance goes out of scope,
* or you explicitly call destroyStylesheet(). You must not delete
* the instance yourself.
*
* @param theStylesheetSource input source
* @param theCompiledStylesheet a reference to a pointer to
XalanCompileStylesheet.
* @return 0 for success
*/
Since the lifetime of the XalanCompiledStylesheet is the lifetime of the
XalanTransformer instance, and you're creating that instance on the stack
in your function, everything created by the XalanTransformer will be
destroyed when your function exits, so your current code cannot work.
If you're going to insist on using Xalan-C through a JNI wrapper, rather
than using the Java version of Xalan, then you should consider using the C
API in src/xalanc/XalanTransformer/XalanCAPI.h. That will isolate you from
some of the details of C++ APIs.
Dave