Reputation:
Hi I already know that we can export data in XML format from jasper. But it is returning jasper tag as well which i don't want. I need only plain xml form. is it possible ? if yes then how?
I am generating xml format through below statement:
jrExporter = new JRXmlExporter();
jrExporter.setParameter(JRXmlExporterParameter.IS_EMBEDDING_IMAGES, Boolean.FALSE);
response.setContentType("application/xml");
jrExporter.setParameter(JRXmlExporterParameter.JASPER_PRINT, jasperPrint);
jrExporter.setParameter(JRXmlExporterParameter.OUTPUT_STREAM, response.getOutputStream());
jrExporter.exportReport();
Hoping some attribute need to set before exporting, but don't know which one.
Upvotes: 4
Views: 3488
Reputation: 3119
This is a common misunderstanding for the JRXmlExporter. JasperReport does not support a data extract of the report via XML. The JRXmlExporter exports the generated report output ie the exact layout specification for each page and element. Also, everything is handled as plain text, so all information if a field was a date or a number is not available.
If you wish to export the data only as XML structure you would need to implement a custom exporter. In order to do so you'd need to define a logic that translates layout structures back into data structures. Based on my research, this can be partially achieved when:
Upvotes: 1