|
|
|
Re: XML Data Source: Where the XML comes from [message #515646 is a reply to message #515623] |
Fri, 19 February 2010 15:58 |
|
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 #545406 is a reply to message #545382] |
Wed, 07 July 2010 16:24 |
|
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 #545883 is a reply to message #545527] |
Fri, 09 July 2010 14:13 |
|
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 #545924 is a reply to message #545903] |
Fri, 09 July 2010 15:26 |
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03886 seconds