hi people, i need some help! i m trying to build in c++ a litle project with
xalan-c.
The idea is to include the functionality of xalanC in my project java, for
it, i download the last sources of xalan and xerces and form a project in
netbeans 6.0.
main.c
#include <stdio.h>
#include <stdlib.h>
#include "WraperXalanC.h"
/*
*
*/
int main(int argc, char** argv)
{
WraperXalanC a;
return (EXIT_SUCCESS);
}
WraperXalanC.h
#include <string.h>
#include <iostream>
#include <xalanc/Include/PlatformDefinitions.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include <xalanc/XalanTransformer/XalanTransformer.hpp>
#include <xalanc/XalanTransformer/XalanCompiledStylesheet.hpp>
#ifndef _WRAPERXALANC_H
#define _WRAPERXALANC_H
using namespace std;
class WraperXalanC
{
bool inicializado;
public:
WraperXalanC();
~WraperXalanC();
void inicializar();
XalanCompiledStylesheet crearTranslet(char *cadena);
XSLTResultTarget renderView(char *xml,XalanCompiledStylesheet
plantillaXsl);
};
#endif /* _WRAPERXALANC_H */
WraperXalanC.cc
#include "WraperXalanC.h"
public class WraperXalanC{
public:
WraperXalanC(){
inicializado=false;
if (!inicializado){
inicializar();
inicializado=true;
}
}
~WraperXalanC(){}
void inicializar(){
try
{
XALAN_USING_XERCES(XMLPlatformUtils)
XALAN_USING_XALAN(XalanTransformer)
XALAN_USING_STD(cerr)
XALAN_USING_STD(cout)
XALAN_USING_STD(endl)
XALAN_USING_STD(ostrstream)
XALAN_USING_XALAN(XalanCompiledStylesheet)
XALAN_USING_XALAN(XalanDOMString)
XALAN_USING_XALAN(XalanParsedSource)
XALAN_USING_XALAN(XalanTransformer)
XALAN_USING_XALAN(XSLTInputSource)
XALAN_USING_XALAN(XSLTResultTarget)
// Call the static initializer for Xerces.
XMLPlatformUtils::Initialize();
// Initialize Xalan.
XalanTransformer::initialize();
cout<<"XALANC inicializado.";
}catch(...){
cout<<"Error al inicializar XALANC";
}
}
XalanCompiledStylesheet crearTranslet(char *cadena){
//Tiene que ser local al metodo? no podria ser utilizado por todos?
XalanTransformer theXalanTransformer;
XalanCompiledStylesheet* compiledStylesheet = null;
int error=
theXalanTransformer.compileStylesheet(cadena,compiledStylesheet);
return compiledStylesheet;
}
XSLTResultTarget renderView(char *xml,XalanCompiledStylesheet
plantillaXsl){
XalanTransformer theXalanTransformer;
XSLTResultTarget theResultTarget;
// hago la transformacion
int theResult = theXalanTransformer.transform(xml, plantillaXsl,
theResultTarget);
//habria que convertir el XSLTResultTarget en un chorro de bytes o
algo asi
if (theResult!=0){
//la conversion no ha tenido exito!
}
//habria que devolver el objeto resultante, o por lo menos la
informacion
//contenida en el, debe ser algo a bajo nivel
theResultTarget.getCharacterStream();
return theResultTarget;
}
};
};
the errors are:
WraperXalanC.h:32: error: ‘XalanCompiledStylesheet’ does not name a type
WraperXalanC.h:34: error: ‘XalanCompiledStylesheet’ no se puede declarar
Ubuntu linux with netbeans6, jdk6, xalan-c 2.7.0 and current xerces
[EMAIL PROTECTED]:/usr/local/include$ g++ --version
g++ (GCC) 4.1.2 (Ubuntu 4.1.2-0ubuntu4)
Copyright (C) 2006 Free Software Foundation, Inc.
Esto es software libre; vea el código para las condiciones de copia. NO hay
garantía; ni siquiera para MERCANTIBILIDAD o IDONEIDAD PARA UN PROPÓSITO EN
PARTICULAR
anybody could help me?
--
View this message in context:
http://www.nabble.com/building-a-jni-bridge-between-java-and-xalan-c-tp15039293p15039293.html
Sent from the Xalan - C - Users mailing list archive at Nabble.com.