2004 IR Help Posted August 24, 2006 Share Posted August 24, 2006 By: sadsd - micasa Problem using XML Data source 2005-06-02 09:36 Hello I have a little problem with the xmlData Source. I'm trying to create a pdf out of an xml that contains certain info. When i do it in ireports i haven't got problems, the pdf will be created perfectly and it will show all the data. My problem starts when i try to do the same in my web aplication, i can get the pdf done but the info wont apear, i guess i'm missing something, could someone tell me if there's anything wrong in this code? I don't get any error message on my catalina.out log. Thanxs String reportFile = application.getRealPath("/intranet/listadospdf/clientes.jasper"); Map parameters = new HashMap(); String outFileName = application.getRealPath("/intranet/listadospdf/clientes.pdf"); File xmlFileName = new File("C:\ccity\webapps\ROOT_dike\intranet\listadospdf\clientes.xml"); String recordPath = "/CLIENTES/ID"; JRXMLDataSource jrxmlds = new JRXMLDataSource(xmlFileName,recordPath); JasperPrint print = JasperFillManager.fillReport(reportFile,parameters,jrxmlds); JRExporter exporter = new net.sf.jasperreports.engine.export.JRPdfExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT,print); exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,outFileName); exporter.exportReport(); By: sadsd - micasa RE: Problem using XML Data source 2005-06-03 01:21 Thaxs for the answer, now i get the record out but it doenst print the data. It's really strange, i get the pdf done with the number of records the suposdly had to print but no data in them. By: Bogdan - cecenu RE: Problem using XML Data source 2005-06-03 01:40 I don't konw if it helps but when you edit the report in iReport, when defining a field you have to put at "Description" the rest of the path from the "recordPath" through the filed tag. Exemple: xml_structure: <FooRoot> <FooTag> <FooInfo>Information</FooInfo> </FooTag> </FooRoot> Let's say you set the record path to "/FooRoot/FooTag". For the field FooInfo, in iReport you set the field name "FooInfo" (or whatever you want), but in the descrription, you must put "FooInfo". Or if you use as record path only "FooRoot", at description you must put: "/FooTag/FooInfo" I hope it helps. By: Bogdan - cecenu RE: Problem using XML Data source 2005-06-02 23:26 Hello. I sugest to check again if the "recordPath" in the application is the same as the one in iReport. I also use XmlDataSource and when same hapens to me, this is the problem. And I think it is case sentive. By: nishant - nkaushik RE: Problem using XML Data source 2006-04-03 07:18 hi! did u ever get this problem resolved? i am facing the same problem,everything is fine but when i run it from RAD inside a portlet i keep getting nulls in the pdf. Please Advice Nishant 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