carlos.cotelo Posted March 12, 2008 Share Posted March 12, 2008 i can't execute a jrxml in my iReport because of the xml datasource it uses.It's a xml in ISO-8859-1 encoding, but in the first line of the xml it has only the xml version, not the encoding:Code:<?xml version="1.0"?> I make also a webapp, and here, there aren't any kind of problem to compile and execute the jrxml with the same datasource that in iReport, the code to execute this is:Code:[code]String resultFileName = getResultFileName(template); File createdFile = new File(getPdfsDir(), resultFileName); System.out.println(" creating output file ... "«»); DOMParser parser = new DOMParser(); InputSource in = new InputSource(); in.setEncoding("ISO-8859-1"«»); in.setByteStream(new FileInputStream(new File(getXmlInputDir(), inputFileName))); parser.parse(in); System.out.println(" correctly parsed: "«»); Document doc = parser.getDocument(); File file = new File(getTemplatesDir(), template); System.out.println(" TemplateFileName " + file.getAbsolutePath()); InputStream inputStream = new FileInputStream(file); jasperReport = JasperCompileManager.compileReport(inputStream); jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(), new JRXmlDataSource(doc)); JRPdfExporter exporterPDF = new JRPdfExporter(); exporterPDF.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporterPDF.setParameter(JRExporterParameter.OUTPUT_FILE, createdFile); exporterPDF.exportReport(); How can i do it with iReport?I try changed the ireport.encoding property, via Edit/Personal Properties (or personal profiles, i have iReport in spanish, is Editar/Propiedades personales), but it doesn't seem to work.I can't change my xml datasource to add the encoding (it's client's responsability...)Thanks for your replies. Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted March 13, 2008 Share Posted March 13, 2008 What errordo you get? giulio Link to comment Share on other sites More sharing options...
carlos.cotelo Posted March 13, 2008 Author Share Posted March 13, 2008 it seems that iReport can't process the xml datasource.By example, i can't get any values searching with xpath when i run the queries in iReport, in the utility "Data/Consulta de Informe".In this utility ("Query report"), in the part "Proveedor Fuente de Datos" the message "The active connection is not a Jasper Reports Datasource provider" appears when i touch the button "Coger datos de la fuente de datos".When i try to execute the jrxml inside iReport, nothing happens, simply nothing. Any pdf is created.And any error is show in the screen.As i say in the first message, i think that the codification (in the ISO-8859-1 encoding) of the xml datasource is the problem here. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now