Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Set a XML DataSource programmatically
Mikey
Hello World,<br />
<br />
Here is what I am trying to do:-<br />
<br />
I have created a report called test.rptdesign. I have specified a XSD file as the datasource of my report and the report's dataset contains the elements in the XSD schema.<br />
<br />
right, now I am want to invoke this report programmatically. I have a Java Object that I have converted to XML (using JAXB) and I now want to set the XML as the datasource for this report at runtime. <br />
<br />
ie., While design time, I have specified a XSD schema as my datasource, but while run time I want the report to point to a XML file. Makes sense? How would I go about doing this?<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
String xmlString = "<application>.................</application>";
ReportDesignHandle reportDesignHandle = (ReportDesignHandle)design.getDesignHandle();
SlotHandle dataSets = reportDesignHandle.getDataSets();
</pre>
<br />
How can set the xmlString as my dataSource? Any ideas / pointers?<br />
<br />
Regards,<br />
Mikey
Find more posts tagged with
Comments
lpurba
Hi Mikey,<br />
<br />
I hope this link will help you.<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.com/modules/wfdownloads/singlefile.php?cid=2&lid=197'>http://www.birt-exchange.com/modules/wfdownloads/singlefile.php?cid=2&lid=197</a><br
/>
<br />
-Laurent
Mikey
Hmm.. not quite. The link shows me how to parse a XML file.
But what I am after is a setting up a XML datasource programatically
Mikey
<blockquote class='ipsBlockquote' data-author="Mikey"><p>Hmm.. not quite. The link shows me how to parse a XML file.<br />
<br />
But what I am after is a setting up a XML datasource programatically</p></blockquote>
<br />
Ok. I figured it out.. This is how you do it:-<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
String xml="<employee><name>mikey</name>...............................</employee>";
config.getAppContext().put("org.eclipse.datatools.enablement.oda.xml.inputStream", newByteArrayInputStream(xml.getBytes()));
</pre>
schmidtkevina
Mikey,
Any idea how to do this if you want to point the BIRT report to a file to read rather than an input stream?
Or would you need to read the file in and then set the stream?
I've got two datasources, two different XML files, can you set each?
Thanks,
Kevin
Shivani_T
Hi Mikey,<br />
<br />
I want to implement the same behavior. Currently I have code written in Ruby to connect to the BIRT datasource programmatically but now for performance reasons we want to use the JAXB, can you please.. help me with this?<br />
As I see you have already implemented the same thing.<br />
<br />
It will be a great help if you can share the step or the sample code for this implementation as I am not very good at Java<br />
<br />
Thanks in advance,<br />
Shivani<br />
<br />
<blockquote class='ipsBlockquote' data-author="'Mikey'" data-cid="29669" data-time="1200871143" data-date="20 January 2008 - 04:19 PM"><p>
Hello World,<br />
<br />
<br />
Here is what I am trying to do:-<br />
<br />
<br />
I have created a report called test.rptdesign. I have specified a XSD file as the datasource of my report and the report's dataset contains the elements in the XSD schema.<br />
<br />
<br />
right, now I am want to invoke this report programmatically. I have a Java Object that I have converted to XML (using JAXB) and I now want to set the XML as the datasource for this report at runtime. <br />
<br />
<br />
ie., While design time, I have specified a XSD schema as my datasource, but while run time I want the report to point to a XML file. Makes sense? How would I go about doing this?<br />
<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
String xmlString = "<application>.................</application>";
ReportDesignHandle reportDesignHandle = (ReportDesignHandle)design.getDesignHandle();
SlotHandle dataSets = reportDesignHandle.getDataSets();
</pre>
<br />
<br />
How can set the xmlString as my dataSource? Any ideas / pointers?<br />
<br />
<br />
Regards,<br />
<br />
Mikey<br /></p></blockquote>