Create XML Data source using DE API [message #1021631] |
Wed, 20 March 2013 08:33  |
Eclipse User |
|
|
|
HI,
I have a requirement and I guess BIRT supports it. Explained the scenario briefly.
In ReportDesigner ( Eclipse Perspective )
1. Created a Report using ReportDesigner in Eclipse
2. Created a XML Datasource by giving XSD alone ( Not XML file )
3. Created a Data Set for the above data source
4. Dragged and dropped the Data Sets in layout.
Now i have to input a XML file to the data source which got created by giving XSD alone, through a java code.
So Is there a option to deal with DesignEngine API for this scenario???
Any help will be really appreciated..
Thanks in advance,
Vinoth
|
|
|
|
|
|
|
Re: Create XML Data source using DE API [message #1029786 is a reply to message #1027606] |
Sat, 30 March 2013 02:00  |
Eclipse User |
|
|
|
I do not have an example of this but if your xml data source is nested in a table that contains clob xml you may be able to set the xml stream in the oncreate of the data item. As a simple example in a beforeOpen script on an xml data source you can do something like:
importPackage( Packages.java.io );
var mystr = "<?xml version=\"1.0\"?>";
mystr = mystr + "<library>";
mystr = mystr + "<book category=\"COOKING\">";
mystr = mystr + "<title lang=\"en\">The test3 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();
appcon.put("org.eclipse.datatools.enablement.oda.xml.inputStream", bais);
In your case you would read the value in the oncreate of the data item containing the clob and then then nested dataset should pickup the new inputStream for each row.
|
|
|
Powered by
FUDForum. Page generated in 0.04955 seconds