Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » XML Data Source: Where the XML comes from
XML Data Source: Where the XML comes from [message #515555] Fri, 19 February 2010 11:14 Go to next message
Jan Kohnert is currently offline Jan KohnertFriend
Messages: 196
Registered: July 2009
Senior Member
Hello,

I'm working on a report using a XML Data Source. I'm using the BIRT engine encapsulated in my RCP application. The BIRT viewer is not used.
How can I pass a XML to a run and render task in order to serve as data source? Can a pass a DOM object instead a XML file?

Thanks,
Jan
Re: XML Data Source: Where the XML comes from [message #515613 is a reply to message #515555] Fri, 19 February 2010 14:26 Go to previous messageGo to next message
Jan Kohnert is currently offline Jan KohnertFriend
Messages: 196
Registered: July 2009
Senior Member
Ithink I found the solution:
http://www.eclipsezone.com/eclipse/forums/t68956.html

Thanks
Re: XML Data Source: Where the XML comes from [message #515623 is a reply to message #515555] Fri, 19 February 2010 14:57 Go to previous messageGo to next message
Jan Kohnert is currently offline Jan KohnertFriend
Messages: 196
Registered: July 2009
Senior Member
It seems like " org.eclipse.birt.report.data.oda.xml.util.XMLDataInputStream " does not exist anymore....

So my problem remains unsolved... Sad
Re: XML Data Source: Where the XML comes from [message #515646 is a reply to message #515623] Fri, 19 February 2010 15:58 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Jan,

Try

appcon.put("org.eclipse.datatools.enablement.oda.xml.inputStream ", bais);

where bais is a bytearrayinputstream.

I did this in report script like:

//beforeOpen of datasource

importPackage( Packages.java.io );

var mystr = "<?xml version=\"1.0\"?>";
mystr = mystr + "<library>";
mystr = mystr + "<book category=\"COOKINGgg\">";
mystr = mystr + "<title lang=\"en\">The test2 Cook Book</title>";
mystr = mystr + "<author name=\"Miguel Ortiz\" country=\"es\"/>";
mystr = mystr + "<sold>10,312</sold>";
mystr = mystr + "<year>2005</year>";
mystr = mystr + "</book>";
mystr = mystr + "<book category=\"CHILDREN\">";
mystr = mystr + "<title lang=\"en\">Everyone is Super Special</title>";
mystr = mystr + "<author name=\"Sally Bush\" country=\"uk\"/>";
mystr = mystr + "<sold>8,222</sold>";
mystr = mystr + "<year>2005</year>";
mystr = mystr + "</book>";
mystr = mystr + "<book category=\"AUTOBIOGRAPHY\">";
mystr = mystr + "<title lang=\"en\">Japanese Greetings</title>";
mystr = mystr + "<author name=\"Taro Yamada\" country=\"uk\"/>";
mystr = mystr + "<sold>7,852</sold>";
mystr = mystr + "<year>2005</year>";
mystr = mystr + "</book>";

mystr = mystr + "<book category=\"WEB\">";
mystr = mystr + "<title lang=\"en\">Query Kick End</title>";
mystr = mystr + "<author name=\"James McGovern\" country=\"us\"/>";
mystr = mystr + "<sold>15,111</sold>";
mystr = mystr + "<year>2006</year>";
mystr = mystr + "</book>";
mystr = mystr + "<audio format=\"CD\" category=\"MUSIC\">";
mystr = mystr + "<title lang=\"en\">Feels Like Home</title>";
mystr = mystr + "<artist name=\"Norah Jones\" country=\"us\"/>";
mystr = mystr + "<sold>9,675</sold>";
mystr = mystr + "<year>2005</year>";
mystr = mystr + "</audio>";
mystr = mystr +"</library>";

JavaStr = new java.lang.String( mystr );
bais = new ByteArrayInputStream( JavaStr.getBytes());
appcon = reportContext.getAppContext();

//apcontext setting
appcon.put("org.eclipse.datatools.enablement.oda.xml.inputStream ", bais);


Jason


Jan Kohnert wrote:
> It seems like "
> org.eclipse.birt.report.data.oda.xml.util.XMLDataInputStream " does not
> exist anymore....
>
> So my problem remains unsolved... :(
>
Re: XML Data Source: Where the XML comes from [message #545382 is a reply to message #515646] Wed, 07 July 2010 15:15 Go to previous messageGo to next message
Cyril Rognon is currently offline Cyril RognonFriend
Messages: 24
Registered: July 2010
Junior Member
Hi all,

the ByteArrayInputStream trick works... under windows.

But we have seen some issue : our development environnement under win32 is working great.

When we use the same report under linux redhat 5 we have an issue : Birt seems not to find the DataSource anymore and issues a "MalformedUrlException / cannot fetch the next data row"
just like when we use a static xml datasource with a wrong path or file name. Or when you have only xsd file and no real xml data to set your design.

Can anyone tell me where I could manage this issue ?

thanks
Cyril Rognon
Re: XML Data Source: Where the XML comes from [message #545406 is a reply to message #545382] Wed, 07 July 2010 16:24 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Cyril,

What path do you have in the datasource for the xml file?

Jason

On 7/7/2010 11:15 AM, Cyril Rognon wrote:
> Hi all,
>
> the ByteArrayInputStream trick works... under windows.
>
> But we have seen some issue : our development environnement under win32
> is working great.
>
> When we use the same report under linux redhat 5 we have an issue : Birt
> seems not to find the DataSource anymore and issues a
> "MalformedUrlException / cannot fetch the next data row"
> just like when we use a static xml datasource with a wrong path or file
> name. Or when you have only xsd file and no real xml data to set your
> design.
>
> Can anyone tell me where I could manage this issue ?
>
> thanks
> Cyril Rognon
Re: XML Data Source: Where the XML comes from [message #545413 is a reply to message #545406] Wed, 07 July 2010 16:51 Go to previous messageGo to next message
Cyril Rognon is currently offline Cyril RognonFriend
Messages: 24
Registered: July 2010
Junior Member
Hi Jason,

thx for this quick answer ! Smile

In the report design I have set a static file name that points to c:\somedirectory\myFile.xml. It contains sample data to be used in preview mode.

I have read that one has to let the static info into the datasource definition even if you provide xml stream at runtime.

Important thing is : running under windows works and running the very same report/calling code under the linux target fails with "I dont find xml datasource" kind of error.

I can send you any sample you want : code, rptdesign and xml file if that helps.

Regards,
Cyril Rognon
Re: XML Data Source: Where the XML comes from [message #545527 is a reply to message #545413] Thu, 08 July 2010 07:48 Go to previous messageGo to next message
Cyril Rognon is currently offline Cyril RognonFriend
Messages: 24
Registered: July 2010
Junior Member
Hi all,

I have been reading a lot on this subject since yesterday and I have noticed the scripted Datasource option.

Unfortunately, I cannot seem to find a propoer sample to set a java event handler that would read the xml file and set it as datasource.

Could anyone point me to one sample ?

Regards,
Cyril Rognon
Re: XML Data Source: Where the XML comes from [message #545883 is a reply to message #545527] Fri, 09 July 2010 14:13 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Cyril,

When you say it works on windows are you swapping in the byte array?
Where does the data come from. You should be able to just change the
filelist in the beforeOpen script to retrieve the file from somewhere
else. Can you post the report?

Jason

On 7/8/2010 3:48 AM, Cyril Rognon wrote:
> Hi all,
>
> I have been reading a lot on this subject since yesterday and I have
> noticed the scripted Datasource option.
>
> Unfortunately, I cannot seem to find a propoer sample to set a java
> event handler that would read the xml file and set it as datasource.
> Could anyone point me to one sample ?
>
> Regards,
> Cyril Rognon
Re: XML Data Source: Where the XML comes from [message #545903 is a reply to message #545883] Fri, 09 July 2010 15:02 Go to previous messageGo to next message
Cyril Rognon is currently offline Cyril RognonFriend
Messages: 24
Registered: July 2010
Junior Member
Hi Jason

I have investigated and found some stuff looking at the oda xml driver (from dtp).

the trouble comes from this driver. It looks at the static name of the xml file provided at design time (for preview).

Then under win32 platform i have to provide this file for the driver to see it.
under linux I have to provide it under a specific location.

I have succeded in usign this. Maybe if I vae time I could provide some XML ODA driver implementation that is mmore open minded and allow to specify dynamically supplied xml stream.

I used your script trick also, either by beforopen or simply by Property binding Smile

I must add that the stream solution only handle the single datasource case. I'll maybe look at scripted datasource to handle multiple xml datasources.

thanks for your concern anyway.
be seeing you
Regards
Cyril
Re: XML Data Source: Where the XML comes from [message #545924 is a reply to message #545903] Fri, 09 July 2010 15:26 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Thanks for posting. If you want you could open a bugzilla entry to get
this improved.

Jason

On 7/9/2010 11:02 AM, Cyril Rognon wrote:
> Hi Jason
>
> I have investigated and found some stuff looking at the oda xml driver
> (from dtp).
> the trouble comes from this driver. It looks at the static name of the
> xml file provided at design time (for preview).
>
> Then under win32 platform i have to provide this file for the driver to
> see it.
> under linux I have to provide it under a specific location.
>
> I have succeded in usign this. Maybe if I vae time I could provide some
> XML ODA driver implementation that is mmore open minded and allow to
> specify dynamically supplied xml stream.
>
> I used your script trick also, either by beforopen or simply by Property
> binding :)
>
> I must add that the stream solution only handle the single datasource
> case. I'll maybe look at scripted datasource to handle multiple xml
> datasources.
>
> thanks for your concern anyway.
> be seeing you
> Regards
> Cyril
Previous Topic:Database name
Next Topic:Minimum slice in chart
Goto Forum:
  


Current Time: Fri Apr 26 08:18:48 GMT 2024

Powered by FUDForum. Page generated in 0.03886 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top