Jump to content
We've recently updated our Privacy Statement, available here ×

reverse jasper to xml


Recommended Posts

By: Michael Mai - mmai

reverse jasper to xml

2003-08-19 11:56

Hi,

Due to my HD crashed, I lost my report xml files. However, I still got *.jasper files. Is there a way to reverse jasper file to xml.

 

Regards,

michael

 

 

By: Michael Mai - mmai

RE: reverse jasper to xml

2003-08-19 13:47

Thank you for quick response. I got error on first line

"Cannot convert from JasperDesign tp JasperReport"

 

Please advise,

 

 

 

By: Gregory A. Swarthout - gswarthout

RE: reverse jasper to xml

2003-08-19 12:16

Yes:

 

JasperReport jasperReport = JasperManager.loadDesign("Whatever.jasper");

 

JRXmlWriter.writeReport(jasperReport, "Whatever.xml");

 

 

 

By: Gregory A. Swarthout - gswarthout

RE: reverse jasper to xml

2003-08-19 14:16

Sorry, want relying on memory. Try this:

 

try {

JasperReport jasperReport = JasperManager.loadReport("Whatever.jasper");

dori.jasper.engine.xml.JRXmlWriter.writeReport(jasperReport, "Whatever.xml");

} catch (dori.jasper.engine.JRException jasperException) {

jasperException.printStackTrace();

}

 

 

 

By: Gregory A. Swarthout - gswarthout

RE: reverse jasper to xml

2003-08-19 14:25

One last sorry. This code WILL work.

 

try {

JasperReport jasperReport = JasperManager.loadReport(fileIn);

dori.jasper.engine.xml.JRXmlWriter.writeReport(jasperReport, fileOut, "UTF8");

} catch (dori.jasper.engine.JRException jasperException) {

jasperException.printStackTrace();

}

 

 

 

By: Michael Mai - mmai

RE: reverse jasper to xml

2003-08-19 14:37

Now I got this error

 

[java] java.io.InvalidClassException: dori.jasper.engine.base.JRBaseReport; local class incompatible: stream classdesc serialVersionUID = 406, local class serialVersionUID = 405

 

at this line:

JasperReport jasperReport = JasperManager.loadReport("WebappReport.jasper");

 

Please Advise

 

Thanks

 

 

By: Gregory A. Swarthout - gswarthout

RE: reverse jasper to xml

2003-08-19 14:58

That error means you are trying to use a different version of JasperReports than the one the .jasper file was created with.

 

 

By: Hathfuri - hathfuri

RE: reverse jasper to xml

2005-02-17 11:40

So is this to say that only .jasper files created with the version of Jasper on the server will work? No back-wards compatibility here?

 

This would appear to be a major problem.

 

 

By: Michael Mai - mmai

RE: reverse jasper to xml

2003-08-19 15:07

This time I got compiled error:

 

[java] java.lang.Error: Unresolved compilation problem:

[java] The method writeReport(JRReport) in the type JRXmlWriter is not

applicable for the arguments (JasperReport, String, String)

 

 

By: Gregory A. Swarthout - gswarthout

RE: reverse jasper to xml

2003-08-19 15:15

I can no longer help you, then. The code I gave you (the last one) I tested myself and it worked. Here it is again:

 

public static void recreateJasperXML(String fileIn, String fileOut) {

try {

JasperReport jasperReport = JasperManager.loadReport(fileIn);

dori.jasper.engine.xml.JRXmlWriter.writeReport(jasperReport, fileOut, "UTF8");

} catch (dori.jasper.engine.JRException jasperException) {

jasperException.printStackTrace();

}

}

 

 

 

By: Michael Mai - mmai

RE: reverse jasper to xml

2003-08-19 15:20

Thanks all your help. I will get correct jasperreport and try it again.

 

Regards,

Michael

 

 

By: Gregory A. Swarthout - gswarthout

RE: reverse jasper to xml

2003-08-19 15:23

I found out I do have one last thing to add. The code I gave you will only work for a report compiled by JasperReports v0.5.0, to get the same code to work with JasperReports v0.4.6, omit the "UTF8" parameter from the writeReport method.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...