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)
How to handle XML content stored within oracle?
sentoo
Hello together,<br />
<br />
I am to create a report (my first report) that operates on an Oracle DB, so far so good. My problem/question is that the interesting column contains its' information as XML. From Oracle's point of view it is a CLOB.<br />
<br />
Background information:<br />
That table holds logging information from different applications. The information contained is about the application usage. As these applications differ quite much, they do not have a common DTD. That is why the column is of type CLOB and not XMLTYPE.<br />
<br />
Within such an XML information like this may be stored:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'><?xml version="1.0"?>
<Search>
<section name='java'/>
<section name='eclipse'/>
<Term>
<operator value='OR'/>
<searchField name='title' value='j2ee tutorial'/>
</Term>
<Term>
<operator value='OR'/>
<searchField name='year' value='2008'/>
</Term>
</Search></pre>
<br />
Thanks in advance for your time.<br />
<br />
P.S. I hope the answer is not too trivial, as I have searched for a solution, but have not found something yet. Probably I am missing the right keyword to search for.
Find more posts tagged with
Comments
bhanley
First off, given the many ways BIRT can access data, I am sure there is not a single correct answer to this question. My opinion would be to create a scripted data source. This allows you the greatest degree of flexibility in how you access and process each XML stream in the DB. The issue here is that you need to use an XML data source to process your data, but the XML cannot be processed via an accessible URL; you need to go through a DB driver to get to the data itself. The different access needs introduce enough complexity that I would manage things in the Java layer and produce the data set that way.<br />
<br />
A scripted data source involves three things:<br />
<br />
<ul class='bbcol decimal'><li>A POJO representing a "row" of data on the report</li><li>A POJO that has an array of the data objects described in #1 and an iterator to access each object in the array.</li><li>A script in the onFetch method of the Data Set to map the POJO fields to the BIRT Data Set</li></ul>
<br />
It sounds complex, but it is really not. You access the XML in the Java layer and process it to produce an array of simple POJOs. <br />
<br />
There are lots of examples here and elsewhere on the Internet guiding you through the creation of this kind of data source. If you get stuck, post the questions here. I will watch the thread and get you through whatever comes up.<br />
<br />
The site is here to help. Good Luck!