Jump to content
JasperReports Library 7.0 is now available ×

Question about XML file datasource


2006 IR Open Dicussion

Recommended Posts

By: jorge - jorge_msf

Question about XML file datasource

2006-01-16 07:18

If i have a report with a XML file datasource is possible to pass the name/location of the XML file as a parameter? If so, how?

 

Thanks

 

 

 

 

By: Wal Millard - walmillard

RE: Question about XML file datasource

2006-01-23 21:58

 

jorge,

 

You need to set the path using the correct file seperator for ur OS. Windows uses "" while unix use "". Because "" is a delimiter in java you must use \ to get in the output.

 

i call jasper from a servlet, simply pass the path using a String parameter from your java code.

 

ie this is compiled on windows...

 

String myPath = "c:\projects\jbuilder\Data\data.xml";

 

then pass the string to parameter map

 

Map parameters = new HashMap();

parameters.put("Path", myPath);

 

before you call the report.

 

Of course you do realise the only thing you can now do with the xml file is display the actual location on the report. You cannot then bind this file/string parameter to a datasource.

 

luck

walmillard

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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...