Skip to main content



      Home
Home » Archived » BIRT » Create XML Data source using DE API
Create XML Data source using DE API [message #1021631] Wed, 20 March 2013 08:33 Go to next message
Eclipse UserFriend
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 #1022388 is a reply to message #1021631] Thu, 21 March 2013 15:27 Go to previous messageGo to next message
Eclipse UserFriend
Vinoth

Have you tried setting the FILELIST property of your datasource using script?
If you were passing in a parameter with the xml file location you could do it like:

//Data source beforeOpen
this.setExtensionProperty("FILELIST", params["myxmllocation"].value);
Re: Create XML Data source using DE API [message #1022546 is a reply to message #1022388] Fri, 22 March 2013 01:05 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for the clue Jason. It will be helpful if you share a piece of code to set the parameter value dynamically via DE API
Re: Create XML Data source using DE API [message #1027057 is a reply to message #1022546] Tue, 26 March 2013 10:07 Go to previous messageGo to next message
Eclipse UserFriend
Generally you use the RE API to set a parameter value when you run the report. How are you running the report?

Re: Create XML Data source using DE API [message #1027606 is a reply to message #1027057] Wed, 27 March 2013 03:08 Go to previous messageGo to next message
Eclipse UserFriend
I have done it through RE API itself Smile

Now if i have a XML file in DB as CLOB object.

How can i input the clob object to XML data source in Report.

I have done it by converting the CLOB to XML File through java and sent the XML file as input to report.

Main requirement is, while converting clob to XML file, i should not store the XML file in file system or anywhere.

So Is there a option to deal with this scenario inside the scripts of report?.
Re: Create XML Data source using DE API [message #1029786 is a reply to message #1027606] Sat, 30 March 2013 02:00 Go to previous message
Eclipse UserFriend
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.
Previous Topic:Change library inheritance in rptdesign
Next Topic:XML report
Goto Forum:
  


Current Time: Sat Apr 19 14:19:54 EDT 2025

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

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

Back to the top