This can be done using property binding on the xml datasource or a
beforeOpen script event on the xml datasource. You can also use the de
api to change the datasource. For example a property binding expression
would look like:

//Property XML Data Source File using a report parameter for location
//MyXMLPath is a report parameter with a dir like c:/temp
var rp = params["MyXMLPath"].value
"file:///"+rp+"/company.xml";

If you want to use the re/de api when you open the report to run it:
IReportRunnable design = null;
//Open the report design
design = engine.openReportDesign("Reports/TopNPercent.rptdesign");
ReportDesignHandle report = (ReportDesignHandle)design.getDesignHandle( );
//assumes xml datasource is the first in the list. You can also use
//findElement if you have named the data source.
((OdaDataSourceHandle)report.getDataSources().get(0)).setPro perty( "FILELIST",
"c:/myxmllocation/myxmlfile.xml");

Jason

On 9/8/2010 8:17 AM, mika.tapanainen@digia.com wrote:
> Hello,
>
> Is the following possible:
>
> 1) Someone creates the report X with BIRT Designer and uses the A.xml as
> a test datasource
>
> Later (the BIRT Designer is not used after phase 1):
>
> 2) The Java program calls the BIRT Runtime
> 3) The Java program loads the report X
> 4) The Java program sets the datasource to the file B.xml
> 5) The Java program runs the report X
>
> If this is possible. How to do this? With event handlers?
>
> BR,
>
> Mika

are not working. The test.rptdesign report only prints the contents of the one data element of the data.xml file: "test". The RunReport.java didn't replace "test" with the "ttteeessstttt" in my testing.

I also tried the beforeOpen method in the .rptdesign file (test2.rptdesign), but it didn't work with Eclipse viewer or with the RunReport.java example.

Is it possible to see my own beforeOpen method functioning with Eclipse viewer or do I have to call the report from the java code?

Do you know how to fix the problem? I attached below the test files. If you know how to fix the examples, could you send the fixed examples. That would be great!

The issue in your example is that you have a space in the string name:
put("org.eclipse.datatools.enablement.oda.xml.inputStream ",
change to
put("org.eclipse.datatools.enablement.oda.xml.inputStream",