Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » XML Datasource multiple call problem [Partly Resolved]
XML Datasource multiple call problem [Partly Resolved] [message #672188] Fri, 20 May 2011 08:46 Go to next message
Cyril Rognon is currently offline Cyril RognonFriend
Messages: 24
Registered: July 2010
Junior Member
Hi birt power users,

I have been using Birt for some time now and I have been using xml datasource with success.
Lately I have made the usage of runtime parametrized xml datasource : I provide the url of the datasource as a parameter to the report.

Halas, I have juste realizaed that my datasource is call many times durind the rendering or the report.

I have 2 datasets on one XML Datasource retrieved through one url http//server/path-to-xml-source-file

I have tried to inline one http/XML datasource url and to remove my scripting to set FILELIST beforeOpen but it did not erase the multiple call.

Why would the http call appear more htan once ? (4 times in may case)

thx
Cyril

[Updated on: Wed, 25 May 2011 11:43]

Report message to a moderator

Re: XML Datasource multiple call problem [message #672278 is a reply to message #672188] Fri, 20 May 2011 13:52 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

What version of BIRT are you using?

Jason

On 5/20/2011 4:46 AM, Cyril Rognon wrote:
> Hi birt power users,
>
> I have been using Birt for some time now and I have been using xml datasource with success.
> Lately I have made the usage of runtime parametrized xml datasource : I provide the url of the datasource as a parameter to the report.
>
> Halas, I have juste realizaed that my datasource is call many times durind the rendering or the report.
>
> I have 2 datasets on one XML Datasource retrieved through one url http//server/path-to-xml-source-file
>
> I have tried to inline one http/XML datasource url and to remove my scripting to set FILELIST beforeOpen but it did not erase the multiple call.
>
> Why would the http call appear more htan once ? (4 times in may case)
>
> thx
> Cyril
>
Re: XML Datasource multiple call problem [message #673626 is a reply to message #672278] Tue, 24 May 2011 09:40 Go to previous messageGo to next message
Cyril Rognon is currently offline Cyril RognonFriend
Messages: 24
Registered: July 2010
Junior Member
Hi Jason,

I am Using 2.5.


I have tried the very same report with 2.6.2 and it behaves the same way.

One DataSource from url http://server/path/file.xml
2 DataSet that uses this Datasource

4 calls to the http://server/path/file.xml url

Is there some cache property to setup ?

Regards
Cyril
Re: XML Datasource multiple call problem [message #673731 is a reply to message #673626] Tue, 24 May 2011 15:01 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

First the XML data source is used in two data sets, so at least there
will be two URL hits.

Currently xml datasources are not cached. If you are using aggregates
you will have multiple passes over the xml file resulting in additional
calls.

As a work around do you have the option to make the xml local? Or you
could load a byte array input stream in the before open script. Take a
look at the attached example.

Jason

<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.20"
id="1">
<property name="createdBy">Eclipse BIRT Designer Version
2.5.1.v20090903 Build &lt;2.5.1.v20090917-1447></property>
<property name="units">in</property>
<property name="comments">Copyright (c) 2007 &lt;&lt;Your Company
Name here>></property>
<html-property name="description">Creates a blank report with no
predefined content.</html-property>
<text-property name="displayName">Blank Report</text-property>
<property name="iconFile">/templates/blank_report.gif</property>
<property name="layoutPreference">auto layout</property>
<data-sources>
<oda-data-source
extensionID="org.eclipse.datatools.enablement.oda.xml" name="Data
Source" id="6">
<method name="beforeOpen"><![CDATA[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);
//change file location
//this.setExtensionProperty("FILELIST",
"C:\\test\\xmldatasource.xml");]]></method>
<property name="FILELIST">C:\test\xmldatasource.xml</property>
</oda-data-source>
</data-sources>
<data-sets>
<oda-data-set
extensionID="org.eclipse.datatools.enablement.oda.xml.dataSet"
name="Data Set" id="7">
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">category</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">title</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">name</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">sold</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">5</property>
<property name="name">year</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">Data Source</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">category</property>
<property name="nativeName">category</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">title</property>
<property name="nativeName">title</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">name</property>
<property name="nativeName">name</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">sold</property>
<property name="nativeName">sold</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">5</property>
<property name="name">year</property>
<property name="nativeName">year</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
</list-property>
<xml-property
name="queryText"><![CDATA[table0#-TNAME-#table0#:#[/library/book]#:#{category;STRING;/@category},{title;STRING;/title},{name;STRING;/author/@name},{sold;STRING;/sold},{year;STRING;/year}]]></xml-property>
<xml-property name="designerValues"><![CDATA[<?xml
version="1.0" encoding="UTF-8"?>
<model:DesignValues
xmlns:design="http://www.eclipse.org/datatools/connectivity/oda/design"
xmlns:model="http://www.eclipse.org/birt/report/model/adapter/odaModel">
<Version>1.0</Version>
<design:ResultSets derivedMetaData="true">
<design:resultSetDefinitions>
<design:resultSetColumns>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>category</design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>-1</design:precision>
<design:scale>-1</design:scale>
<design:nullability>Unknown</design:nullability>
</design:attributes>
<design:usageHints>
<design:label>category</design:label>
<design:formattingHints/>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>title</design:name>
<design:position>2</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>-1</design:precision>
<design:scale>-1</design:scale>
<design:nullability>Unknown</design:nullability>
</design:attributes>
<design:usageHints>
<design:label>title</design:label>
<design:formattingHints/>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>name</design:name>
<design:position>3</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>-1</design:precision>
<design:scale>-1</design:scale>
<design:nullability>Unknown</design:nullability>
</design:attributes>
<design:usageHints>
<design:label>name</design:label>
<design:formattingHints/>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>sold</design:name>
<design:position>4</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>-1</design:precision>
<design:scale>-1</design:scale>
<design:nullability>Unknown</design:nullability>
</design:attributes>
<design:usageHints>
<design:label>sold</design:label>
<design:formattingHints/>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>year</design:name>
<design:position>5</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>-1</design:precision>
<design:scale>-1</design:scale>
<design:nullability>Unknown</design:nullability>
</design:attributes>
<design:usageHints>
<design:label>year</design:label>
<design:formattingHints/>
</design:usageHints>
</design:resultColumnDefinitions>
</design:resultSetColumns>
</design:resultSetDefinitions>
</design:ResultSets>
</model:DesignValues>]]></xml-property>
<list-property name="privateDriverProperties">
<ex-property>
<name>MAX_ROW</name>
<value>-1</value>
</ex-property>
<ex-property>
<name>XML_FILE</name>
</ex-property>
</list-property>
</oda-data-set>
</data-sets>
<styles>
<style name="crosstab" id="4">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
<style name="crosstab-cell" id="5">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
<style name="detail" id="42">
<property name="backgroundColor">#BACAE2</property>
<property name="fontFamily">"Arial"</property>
<property name="fontSize">small</property>
<property name="paddingTop">0px</property>
<property name="paddingLeft">0px</property>
<property name="paddingBottom">0px</property>
<property name="paddingRight">0px</property>
</style>
<style name="headerfooter" id="43">
<property name="backgroundColor">#004080</property>
<property name="fontFamily">"Arial"</property>
<property name="fontSize">small</property>
<property name="fontWeight">bold</property>
<property name="color">#FFFFFF</property>
</style>
<style name="groupheader" id="44">
<property name="backgroundColor">#0080FF</property>
<property name="fontFamily">"Arial"</property>
<property name="fontSize">small</property>
<property name="fontWeight">bold</property>
<property name="color">#FFFFFF</property>
</style>
</styles>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2">
<property name="topMargin">1in</property>
<property name="leftMargin">1.25in</property>
<property name="bottomMargin">1in</property>
<property name="rightMargin">1.25in</property>
<page-footer>
<text id="3">
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property>
</text>
</page-footer>
</simple-master-page>
</page-setup>
<body>
<grid id="49">
<property name="borderBottomColor">#004080</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">medium</property>
<property name="borderLeftColor">#004080</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">medium</property>
<property name="borderRightColor">#004080</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">medium</property>
<property name="borderTopColor">#004080</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">medium</property>
<property name="width">7in</property>
<column id="50"/>
<row id="51">
<cell id="52">
<extended-item extensionName="Chart" name="mychart"
id="48">
<xml-property
name="xmlRepresentation"><![CDATA[<model:ChartWithAxes
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:attribute="http://www.birt.eclipse.org/ChartModelAttribute"
xmlns:data="http://www.birt.eclipse.org/ChartModelData"
xmlns:layout="http://www.birt.eclipse.org/ChartModelLayout"
xmlns:model="http://www.birt.eclipse.org/ChartModel"
xmlns:type="http://www.birt.eclipse.org/ChartModelType">
<Type>Bar Chart</Type>
<SubType>Side-by-side</SubType>
<Block>
<Children xsi:type="layout:TitleBlock">
<Bounds>
<Left>0.0</Left>
<Top>0.0</Top>
<Width>0.0</Width>
<Height>0.0</Height>
</Bounds>
<Insets>
<Top>3.0</Top>
<Left>3.0</Left>
<Bottom>3.0</Bottom>
<Right>3.0</Right>
</Insets>
<Row>-1</Row>
<Column>-1</Column>
<Rowspan>-1</Rowspan>
<Columnspan>-1</Columnspan>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Visible>true</Visible>
<Label>
<Caption>
<Value>Bar Chart Title</Value>
<Font>
<Size>16.0</Size>
<Bold>true</Bold>
<Alignment>
<horizontalAlignment>Center</horizontalAlignment>
<verticalAlignment>Center</verticalAlignment>
</Alignment>
</Font>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>true</Visible>
</Label>
</Children>
<Children xsi:type="layout:Plot">
<Bounds>
<Left>0.0</Left>
<Top>0.0</Top>
<Width>0.0</Width>
<Height>0.0</Height>
</Bounds>
<Insets>
<Top>3.0</Top>
<Left>3.0</Left>
<Bottom>3.0</Bottom>
<Right>3.0</Right>
</Insets>
<Row>-1</Row>
<Column>-1</Column>
<Rowspan>-1</Rowspan>
<Columnspan>-1</Columnspan>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Visible>true</Visible>
<HorizontalSpacing>5</HorizontalSpacing>
<VerticalSpacing>5</VerticalSpacing>
<ClientArea>
<Outline>
<Style>Solid</Style>
<Thickness>0</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>0.0</Left>
<Bottom>0.0</Bottom>
<Right>0.0</Right>
</Insets>
</ClientArea>
</Children>
<Children xsi:type="layout:Legend">
<Bounds>
<Left>0.0</Left>
<Top>0.0</Top>
<Width>0.0</Width>
<Height>0.0</Height>
</Bounds>
<Insets>
<Top>3.0</Top>
<Left>3.0</Left>
<Bottom>3.0</Bottom>
<Right>3.0</Right>
</Insets>
<Row>-1</Row>
<Column>-1</Column>
<Rowspan>-1</Rowspan>
<Columnspan>-1</Columnspan>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Visible>true</Visible>
<ClientArea>
<Outline>
<Style>Solid</Style>
<Thickness>0</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Insets>
<Top>2.0</Top>
<Left>2.0</Left>
<Bottom>2.0</Bottom>
<Right>2.0</Right>
</Insets>
</ClientArea>
<Text>
<Value></Value>
<Font>
<Alignment/>
</Font>
</Text>
<Orientation>Vertical</Orientation>
<Direction>Top_Bottom</Direction>
<Separator>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>true</Visible>
</Separator>
<Position>Right</Position>
<ItemType>Categories</ItemType>
<Title>
<Caption>
<Value></Value>
<Font>
<Alignment/>
</Font>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>false</Visible>
</Title>
<TitlePosition>Above</TitlePosition>
</Children>
<Bounds>
<Left>0.0</Left>
<Top>0.0</Top>
<Width>509.99999999759996</Width>
<Height>309.00000000240004</Height>
</Bounds>
<Insets>
<Top>3.0</Top>
<Left>3.0</Left>
<Bottom>3.0</Bottom>
<Right>3.0</Right>
</Insets>
<Row>-1</Row>
<Column>-1</Column>
<Rowspan>-1</Rowspan>
<Columnspan>-1</Columnspan>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Visible>true</Visible>
</Block>
<Dimension>Two_Dimensional</Dimension>
<Units>Points</Units>
<SeriesThickness>10.0</SeriesThickness>
<SampleData>
<BaseSampleData>
<DataSetRepresentation>A, B, C</DataSetRepresentation>
</BaseSampleData>
<OrthogonalSampleData>
<DataSetRepresentation>5,4,12</DataSetRepresentation>
<SeriesDefinitionIndex>0</SeriesDefinitionIndex>
</OrthogonalSampleData>
</SampleData>
<Interactivity/>
<EmptyMessage>
<Caption>
<Value></Value>
<Font>
<Alignment/>
</Font>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>false</Visible>
</EmptyMessage>
<Axes>
<Type>Text</Type>
<Title>
<Caption>
<Value>X-Axis Title</Value>
<Font>
<Size>14.0</Size>
<Bold>true</Bold>
<Alignment>
<horizontalAlignment>Center</horizontalAlignment>
<verticalAlignment>Center</verticalAlignment>
</Alignment>
</Font>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>false</Visible>
</Title>
<TitlePosition>Below</TitlePosition>
<AssociatedAxes>
<Type>Linear</Type>
<Title>
<Caption>
<Value>Y-Axis Title</Value>
<Font>
<Size>14.0</Size>
<Bold>true</Bold>
<Alignment>
<horizontalAlignment>Center</horizontalAlignment>
<verticalAlignment>Center</verticalAlignment>
</Alignment>
<Rotation>90.0</Rotation>
</Font>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>false</Visible>
</Title>
<TitlePosition>Left</TitlePosition>
<SeriesDefinitions>
<Query>
<Definition></Definition>
</Query>
<SeriesPalette>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>80</Red>
<Green>166</Green>
<Blue>218</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>242</Red>
<Green>88</Green>
<Blue>106</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>232</Red>
<Green>172</Green>
<Blue>57</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>255</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>64</Red>
<Green>128</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>128</Green>
<Blue>192</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>170</Red>
<Green>85</Green>
<Blue>85</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>128</Green>
<Blue>0</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>192</Red>
<Green>192</Green>
<Blue>192</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>192</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>7</Red>
<Green>146</Green>
<Blue>94</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>0</Red>
<Green>128</Green>
<Blue>255</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>255</Red>
<Green>128</Green>
<Blue>192</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>0</Red>
<Green>255</Green>
<Blue>255</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>255</Red>
<Green>128</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>0</Red>
<Green>128</Green>
<Blue>192</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>128</Green>
<Blue>192</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>255</Red>
<Green>0</Green>
<Blue>255</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>64</Green>
<Blue>64</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>255</Red>
<Green>128</Green>
<Blue>64</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>80</Red>
<Green>240</Green>
<Blue>120</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>0</Red>
<Green>64</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>0</Green>
<Blue>64</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>255</Red>
<Green>0</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>128</Green>
<Blue>64</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>128</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>255</Red>
<Green>128</Green>
<Blue>255</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>0</Red>
<Green>64</Green>
<Blue>0</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>255</Red>
<Green>128</Green>
<Blue>0</Blue>
</Entries>
</SeriesPalette>
<Series xsi:type="type:BarSeries">
<Visible>true</Visible>
<Label>
<Caption>
<Value></Value>
<Font>
<Alignment/>
</Font>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>false</Visible>
</Label>
<DataDefinition>
<Definition>row[&quot;sold&quot;]</Definition>
</DataDefinition>
<SeriesIdentifier></SeriesIdentifier>
<DataPoint>
<Components>
<Type>Orthogonal_Value</Type>
</Components>
<Separator>, </Separator>
</DataPoint>
<LabelPosition>Outside</LabelPosition>
<Stacked>false</Stacked>
<Riser>Rectangle</Riser>
</Series>
<Grouping>
<Enabled>false</Enabled>
<GroupingInterval>2.0</GroupingInterval>
<GroupType>Text</GroupType>
<AggregateExpression>Sum</AggregateExpression>
</Grouping>
<Sorting>Ascending</Sorting>
</SeriesDefinitions>
<Orientation>Vertical</Orientation>
<LineAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>true</Visible>
</LineAttributes>
<Label>
<Caption>
<Value></Value>
<Font>
<Alignment/>
</Font>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>true</Visible>
</Label>
<LabelPosition>Left</LabelPosition>
<MajorGrid>
<LineAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>196</Red>
<Green>196</Green>
<Blue>196</Blue>
</Color>
<Visible>false</Visible>
</LineAttributes>
<TickStyle>Across</TickStyle>
<TickAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>196</Red>
<Green>196</Green>
<Blue>196</Blue>
</Color>
<Visible>true</Visible>
</TickAttributes>
</MajorGrid>
<MinorGrid>
<LineAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>225</Red>
<Green>225</Green>
<Blue>225</Blue>
</Color>
<Visible>false</Visible>
</LineAttributes>
<TickStyle>Across</TickStyle>
<TickAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>225</Red>
<Green>225</Green>
<Blue>225</Blue>
</Color>
<Visible>false</Visible>
</TickAttributes>
</MinorGrid>
<Scale>
<MinorGridsPerUnit>5</MinorGridsPerUnit>
</Scale>
<Origin>
<Type>Min</Type>
<Value xsi:type="data:NumberDataElement">
<Value>0.0</Value>
</Value>
</Origin>
<PrimaryAxis>true</PrimaryAxis>
<Percent>false</Percent>
</AssociatedAxes>
<SeriesDefinitions>
<Query>
<Definition></Definition>
</Query>
<SeriesPalette>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>80</Red>
<Green>166</Green>
<Blue>218</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>242</Red>
<Green>88</Green>
<Blue>106</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>232</Red>
<Green>172</Green>
<Blue>57</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>255</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>64</Red>
<Green>128</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>128</Green>
<Blue>192</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>170</Red>
<Green>85</Green>
<Blue>85</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>128</Green>
<Blue>0</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>192</Red>
<Green>192</Green>
<Blue>192</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>192</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>7</Red>
<Green>146</Green>
<Blue>94</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>0</Red>
<Green>128</Green>
<Blue>255</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>255</Red>
<Green>128</Green>
<Blue>192</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>0</Red>
<Green>255</Green>
<Blue>255</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>255</Red>
<Green>128</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>0</Red>
<Green>128</Green>
<Blue>192</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>128</Green>
<Blue>192</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>255</Red>
<Green>0</Green>
<Blue>255</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>64</Green>
<Blue>64</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparenc
Re: XML Datasource multiple call problem [message #673912 is a reply to message #673731] Wed, 25 May 2011 07:11 Go to previous messageGo to next message
Cyril Rognon is currently offline Cyril RognonFriend
Messages: 24
Registered: July 2010
Junior Member
Hello Jason

thank you for your so quick reply.

it seems the xml of the rptdesign is truncated at the end.

thx
Cyril
Re: XML Datasource multiple call problem [message #673945 is a reply to message #673912] Wed, 25 May 2011 08:54 Go to previous messageGo to next message
Cyril Rognon is currently offline Cyril RognonFriend
Messages: 24
Registered: July 2010
Junior Member
I have taken your datasource script and it works.
now I would like to read my xml over http in place of your inlined xml string. Could anyone point me out how to do some httpget and get the content ? (wich is an xml string)

thanks
Cyril
Re: XML Datasource multiple call problem [message #673981 is a reply to message #673945] Wed, 25 May 2011 11:33 Go to previous messageGo to next message
Cyril Rognon is currently offline Cyril RognonFriend
Messages: 24
Registered: July 2010
Junior Member
Hi again,

I have used your script and some basic java urlconnection stuff :

importPackage(Packages.java.io );
importPackage(Packages.java.net );

//url setup from parameter values
url = new URL(params["source_uri"]+params["reference"]);

// GET HTTP 
connection  = url.openConnection();
is = connection.getInputStream();

appcon = reportContext.getAppContext();

//apcontext setting
appcon.put("org.eclipse.datatools.enablement.oda.xml.inputStream", is);


it works. I now have only 2 access to the datasource URL.
Now I'll have to look into the ODA code to see why the Datasource is called for each Dataset.

Thx for your Help Jason, I managed to get this far thanks to you !

My best
Cyril
Re: XML Datasource multiple call problem [message #674034 is a reply to message #673981] Wed, 25 May 2011 15:38 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you try something like the following:

In the beforeFactory of the report put code in like:

importPackage(Packages.java.lang);
importPackage(Packages.java.net);
importPackage(Packages.java.io);
var url = new URL("http://localhost:8090/book/BookStore.xml");
connection = url.openConnection();
inp = connection.getInputStream();
contentLength = connection.getContentLength();
bytesa = new ByteArrayOutputStream( contentLength);
var c;
while((c=inp.read()) != -1){
bytesa.write(c);
}
inp.close();
var mybytes = bytesa.toByteArray();
bais = new ByteArrayInputStream( mybytes );

Then in the beforeOpen of each of the datasets enter something like:
bais.reset();
reportContext.getAppContext().put("org.eclipse.datatools.enablement.oda.xml.inputStream",
bais);

Jason

On 5/25/2011 7:33 AM, Cyril Rognon wrote:
> Hi again,
>
> I have used your script and some basic java urlconnection stuff :
>
> importPackage(Packages.java.io );
> importPackage(Packages.java.net );
>
> //url setup from parameter values
> url = new URL(params["source_uri"]+params["reference"]);
>
> // GET HTTP connection = url.openConnection();
> is = connection.getInputStream();
>
> appcon = reportContext.getAppContext();
>
> //apcontext setting
> appcon.put("org.eclipse.datatools.enablement.oda.xml.inputStream", is);
>
> it works. I now have only 2 access to the datasource URL.
> Now I'll have to look into the ODA code to see why the Datasource is
> called for each Dataset.
> Thx for your Help Jason, I managed to get this far thanks to you !
>
> My best
> Cyril
Re: XML Datasource multiple call problem [message #929848 is a reply to message #674034] Mon, 01 October 2012 20:40 Go to previous messageGo to next message
John J Feigal is currently offline John J FeigalFriend
Messages: 31
Registered: July 2009
Member
For a couple of years, my organization has faced this issue that Cyril reported, but I wasn't able to describe it as well as Cyril did.

Jason Weatherby's comment that XML data is not cached finally explained why we were seeing the multiple http traces of the XML data access. I'm assuming that in Birt 3.7.2 that XML data still is not cached.

I have tried to implement Jason's final code suggestion, but I have been running into errors when I run my test report in debug mode.

I have tried a couple of things.

First, in the report's beforeFactory, I have tried to put an input stream in the report's appContext and then get the inputstream from the reports appContext in the dataset's beforeOpen. Jason's original code example showed a reset on the inputStream in the beforeOpen, but I was getting an error indicating the the named inputStream was undefined.

Alterntively, in the report's beforeFactory, I have gried to set a persistent global variable in the report context with the input stream, and then get the input stream from the persistent global variable in the reportContext in the dataset's beforeOpen. I'm getting an error that the method setPersistentGlobalVariable cannot be found in the beforeFactory and the inputStream is undefined in the beforeOpen.

Re: XML Datasource multiple call problem [message #929909 is a reply to message #929848] Mon, 01 October 2012 21:54 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you give some more detail on how you have the report deployed? Are you using the Viewer? Post how you are setting the variable.

Jason
Re: XML Datasource multiple call problem [message #930885 is a reply to message #929909] Tue, 02 October 2012 18:33 Go to previous messageGo to next message
John J Feigal is currently offline John J FeigalFriend
Messages: 31
Registered: July 2009
Member
I'm currently debugging the report in the 3.7.2 BIRT designer. The modified report will eventually be deployed under the BIRT 3.7.2 Viewer Tomcat webapp.

Code in the report beforeFactory:
importPackage(Packages.java.lang);
importPackage(Packages.java.net);
importPackage(Packages.java.io);

var urlOne = new URL( encodeURI( params["dbUrl"] ) + "agtDereferenceXmlViewDataForDocumentCountReportNew?OpenAgent&viewName=vwExportCustomerProfileDataByDocidXml_customerProfile" + "&beginDate=" + params["beginDate"] + "&endDate=" + params["endDate"] + "&dataFieldName=" + params["demographicOne"] + "&dataColumn=1&derefKeywords=true&debug=false&rowCount=1000" );
var connectionOne = urlOne.openConnection();
var inpOne = connectionOne.getInputStream();
var contentLengthOne = connectionOne.getContentLength();
var bytesaOne = new ByteArrayOutputStream( contentLengthOne );
var cOne;
while((cOne = inpOne.read()) != -1)
{
bytesaOne.write( cOne );
}
inpOne.close();
var mybytesOne = bytesaOne.toByteArray();
var demographicOneInputStream = new ByteArrayInputStream( mybytesOne );

//reportContext setting
reportContext.setPersistentGlobalVariable("demographicOneInputStream", demographicOneInputStream );

Code in the dataset beforeOpen:
importPackage(Packages.java.net);
importPackage(Packages.java.io);


var demographicOneInputStream = reportContext.getPersistentGlobalVariable( "demographicOneInputStream" );
demographicOneInputStream.reset();


Errors:
Can't find method org.eclipse.birt.report.engine.script.internal.ReportContextImpl.setPersistentGlobalVariable(string,java.io.ByteArrayInputStream). (/report/method[@name="beforeFactory"]#22)
Re: XML Datasource multiple call problem [message #931121 is a reply to message #930885] Tue, 02 October 2012 23:59 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I believe the issue is that ByteArrayInputStream is not serializable, but in this case you really do not need this call. Drop the var keyword on the following line in the beforeFactory:
var demographicOneInputStream = new ByteArrayInputStream( mybytesOne );
to
//makes it global to downstream process
demographicOneInputStream = new ByteArrayInputStream( mybytesOne );
delete setPersistent line

Then just delete this line in the beforeOpen
var demographicOneInputStream = reportContext.getPersistentGlobalVariable( "demographicOneInputStream" );


Alternatively you could use set and getGlobalVariable instead.

Jason
Re: XML Datasource multiple call problem [message #932099 is a reply to message #931121] Wed, 03 October 2012 20:49 Go to previous messageGo to next message
John J Feigal is currently offline John J FeigalFriend
Messages: 31
Registered: July 2009
Member
Jason

Thanks for your suggestions - they got me past the setPersistentGlobalVariable error.

Based on your suggestions I have some general questions. First, in what situations should "var" not be coded in a Birt script? When I learned JavaScript I got in the habit of coding var the first time I used a variable in a script. Second, why would setGlobalVariable and getGlobalVariable OK to use, but not setPersistentGlobalVariable and getPersistentGlobalVariable in this situation?

Now I have another issue. I see the dynamic URL defined in the report beforeFactory script traced in my weblog. But the data in my report output is still associated with the default URL defined in the XML Data Source Connection Properties of the datasource referenced by the dataset. In the beforeOpen script for the dataset I've still got demographicOneInputStream.reset() coded. Is there additional code required to get the data read from the input stream?

AT this point I need to add that the report that I am working with is more complex than I have described up to this point. I actually have two XML data sources and datasets, I am creating a joined dataset with the two XML datasets, and a crosstab is being generated using the joined dataset. Is the creation of the joint dataset from the two input streams a problem?
Re: XML Datasource multiple call problem [message #932977 is a reply to message #932099] Thu, 04 October 2012 16:19 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

John

var is often best to use, but dropping it does make the variable global to downstream report items. That said a better approach is probably to use the setGlobalVariable as there is no ambiguity in this approach. Persisted global variables are used to write the variable back into the generated rptdocument, and allows the variable to be used at render time. This is often required when using onrender scripts or when you want to pass a generation variable to the chart script(executed at render time not generation).

On your new issue:
Did you set:
reportContext.getAppContext().put("org.eclipse.datatools.enablement.oda.xml.inputStream",
bais);

Jason
Re: XML Datasource multiple call problem [message #934220 is a reply to message #932977] Fri, 05 October 2012 19:18 Go to previous messageGo to next message
John J Feigal is currently offline John J FeigalFriend
Messages: 31
Registered: July 2009
Member
Jason

I'm getting further with the following code in the dataset beforeOpen:
importPackage(Packages.java.lang);
importPackage(Packages.java.net);
importPackage(Packages.java.io);
demographicOneInputStream.reset();
reportContext.getAppContext().put( "org.eclipse.datatools.enablement.oda.xml.inputStream", demographicOneInputStream );

I'm now getting the following errors generated in debug mode:
Oct 5, 2012 1:51:51 PM org.eclipse.datatools.enablement.oda.xml.util.SaxParser run
WARNING: Exceptions occur during xml parsing
Throwable occurred: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:599)
at org.eclipse.datatools.enablement.oda.xml.util.SaxParser.parse(SaxParser.java:168)
at org.eclipse.datatools.enablement.oda.xml.util.SaxParser.run(SaxParser.java:119)
at java.lang.Thread.run(Thread.java:735)
Caused by: org.xml.sax.SAXParseException: Premature end of file.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
... 7 more

Some google searches indicate that some people were seeing the "Premature end of file" error when using chrome or safari browsers with Birt, but I'm using IE.

Our XML files begin with the following specification:
"Content-Type:text/xml"
"<?xml version='1.0' encoding='ISO-8859-1'?>"

Since we have a couple of computed columns defined in the dataset that are not in the XML data, is that a problem? We have date strings in the XML data which are converted to the Birt Date data type so that we can use the dates for crosstab data cube groups.
Re: XML Datasource multiple call problem [message #934243 is a reply to message #934220] Fri, 05 October 2012 19:43 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Is the stream opened before pushing it to the appcontext?

Jason

Re: XML Datasource multiple call problem [message #934256 is a reply to message #934243] Fri, 05 October 2012 19:49 Go to previous messageGo to next message
John J Feigal is currently offline John J FeigalFriend
Messages: 31
Registered: July 2009
Member
Jason:

In the report's beforeFactory script this is coded:

importPackage(Packages.java.lang);
importPackage(Packages.java.net);
importPackage(Packages.java.io);

var urlOne = new URL( encodeURI( params["dbUrl"] ) + "agtDereferenceXmlViewDataForDocumentCountReportNew?OpenAgent&viewName=vwExportCustomerProfileDataByDocidXml_customerProfile" + "&beginDate=" + params["beginDate"] + "&endDate=" + params["endDate"] + "&dataFieldName=" + params["demographicOne"] + "&dataColumn=1&derefKeywords=true&debug=false&rowCount=1000" );
connectionOne = urlOne.openConnection();
inpOne = connectionOne.getInputStream();
contentLengthOne = connectionOne.getContentLength();
bytesaOne = new ByteArrayOutputStream( contentLengthOne );
var cOne;
while((cOne = inpOne.read()) != -1)
{
bytesaOne.write( cOne );
}
inpOne.close();
mybytesOne = bytesaOne.toByteArray();
demographicOneInputStream = new ByteArrayInputStream( mybytesOne );

In the dataset's beforeOpen script this is coded:
importPackage(Packages.java.lang);
importPackage(Packages.java.net);
importPackage(Packages.java.io);

demographicOneInputStream.reset();
reportContext.getAppContext().put( "org.eclipse.datatools.enablement.oda.xml.inputStream", demographicOneInputStream );

Is additional code required to open the input stream? If so, what is the code and where is it placed?
Re: XML Datasource multiple call problem [message #937311 is a reply to message #934256] Mon, 08 October 2012 22:03 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Are you sure the xml structure is the same for the byte array as it is in the xml file you designed the report with? Save the bytearray to a file and compare them:

//add this after you read everything into the byte arrray
outputStream = new FileOutputStream ("c:/temp/test.xml");
byteArrayOutputStream.writeTo(outputStream);


Jason
Re: XML Datasource multiple call problem [message #937399 is a reply to message #937311] Tue, 09 October 2012 00:04 Go to previous messageGo to next message
John J Feigal is currently offline John J FeigalFriend
Messages: 31
Registered: July 2009
Member
Jason

I modified the code in the beforeFactory script to:
importPackage(Packages.java.lang);
importPackage(Packages.java.net);
importPackage(Packages.java.io);

var urlOne = new URL( encodeURI( params["dbUrl"] ) + "agtDereferenceXmlViewDataForDocumentCountReportNew?OpenAgent&viewName=vwExportCustomerProfileDataByDocidXml_customerProfile" + "&beginDate=" + params["beginDate"] + "&endDate=" + params["endDate"] + "&dataFieldName=" + params["demographicOne"] + "&dataColumn=1&derefKeywords=true&debug=false&rowCount=1000" );
connectionOne = urlOne.openConnection();
inpOne = connectionOne.getInputStream();
contentLengthOne = connectionOne.getContentLength();
bytesaOne = new ByteArrayOutputStream( contentLengthOne );
var cOne;
while((cOne = inpOne.read()) != -1)
{
bytesaOne.write( cOne );
}
inpOne.close();

outputStreamOne = new FileOutputStream ("c:/temp/demographicOneInputStream.xml");
bytesaOne.writeTo(outputStreamOne);

mybytesOne = bytesaOne.toByteArray();
demographicOneInputStream = new ByteArrayInputStream( mybytesOne );


The XML data files created in the temp folder look as expected.

It would appear that there is an issue with the conversion of the bytesaOne outputstream to the mbytesOne bytearray or the conversion of the mbytesOne bytearray to the demographicOneInputStream which is referenced in the beforeOpen script of the dataset.
Re: XML Datasource multiple call problem [message #938261 is a reply to message #937399] Tue, 09 October 2012 18:12 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Have you tried adding :

appcon = reportContext.getAppContext();
appcon.put("org.eclipse.datatools.enablement.oda.xml.inputStream", demographicOneInputStream );
to the beforeFactory and removing the beforeOpen sciprt?

Jason
Re: XML Datasource multiple call problem [message #938336 is a reply to message #938261] Tue, 09 October 2012 19:35 Go to previous messageGo to next message
John J Feigal is currently offline John J FeigalFriend
Messages: 31
Registered: July 2009
Member
Jason

Here's the beforeFactory script after making the changes you suggested:
importPackage(Packages.java.lang);
importPackage(Packages.java.net);
importPackage(Packages.java.io);

appcon = reportContext.getAppContext();

var urlOne = new URL( encodeURI( params["dbUrl"] ) + "agtDereferenceXmlViewDataForDocumentCountReportNew?OpenAgent&viewName=vwExportCustomerProfileDataByDocidXml_customerProfile" + "&beginDate=" + params["beginDate"] + "&endDate=" + params["endDate"] + "&dataFieldName=" + params["demographicOne"] + "&dataColumn=1&derefKeywords=true&debug=false&rowCount=1000" );
connectionOne = urlOne.openConnection();
inpOne = connectionOne.getInputStream();
contentLengthOne = connectionOne.getContentLength();
demographicOneInputStream = new ByteArrayOutputStream( contentLengthOne );
var cOne;
while((cOne = inpOne.read()) != -1)
{
demographicOneInputStream.write( cOne );
}
inpOne.close();

appcon.put("org.eclipse.datatools.enablement.oda.xml.inputStream", demographicOneInputStream );

var urlTwo = new URL( params["dbUrl"] + "agtDereferenceXmlViewDataForDocumentCountReportNew?OpenAgent&viewName=vwExportCustomerProfileDataByDocidXml_customerProfile" + "&beginDate=" + params["beginDate"] + "&endDate=" + params["endDate"] + "&dataFieldName=" + params["demographicTwo"] + "&dataColumn=1&derefKeywords=true&debug=false&rowCount=1000" );
connectionTwo = urlTwo.openConnection();
inpTwo = connectionTwo.getInputStream();
contentLengthTwo = connectionTwo.getContentLength();
demographicTwoInputStream = new ByteArrayOutputStream( contentLengthTwo );
var cTwo;
while((cTwo = inpTwo.read()) != -1)
{
demographicTwoInputStream.write(cTwo);
}
inpTwo.close();

appcon.put("org.eclipse.datatools.enablement.oda.xml.inputStream", demographicTwoInputStream );

I removed the lines of code that created a ByteArrayInputStream from a toByteArray:
mybytesOne = bytesaOne.toByteArray();
demographicOneInputStream = new ByteArrayInputStream( mybytesOne );
and
mybytesTwo = bytesaTwo.toByteArray();
demographicTwoInputStream = new ByteArrayInputStream( mybytesTwo );

demographicOneInputStream and demographicTwoInputStream are now created from the streams that created the XML files in the temp folder which I have verified are good.

I am confused, though, why you told me to remove the beforeOpen script code. When I ran the report, it ran successfully, but the data came from my default XML file, not from the streams that were put into the appcontext in the beforeFactory script. How is the dataset supposed to know how to get the XML data from the input streams?

Earlier in this thread, long long ago, you suggested to Cyril to use the toByteArray / ByteArrayInputStream code to save the "dynamic" XML data from the "dynamic" XML data source in memory so that it was only read once. When I used this code I received the XML parse error - premature end of file. When I try to use the input stream data that I have proved is correctly read and saved in temp files, incorrect data is reported.

I hope there is some obvious explanation for what is now happening. If not, I will place the original version of this report in production with the known performance issues, since our production software publish is tomorrow afternoon.

Thanks again for your help with this problem, but I do have to ask, will open source BIRT ever cache XML data which seems like the solution for the issue experienced by Cyril and myself (and possibly others)?



Re: XML Datasource multiple call problem [message #939806 is a reply to message #938336] Thu, 11 October 2012 04:06 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

John

Sorry for the confusion. It has to be an input stream.

Go back to this code (note that none of the code is in the beforeOpen. This should be ok because the inputstream is in the appcontext, which the xml driver should read):
importPackage(Packages.java.lang);
importPackage(Packages.java.net);
importPackage(Packages.java.io);

var urlOne = new URL( encodeURI( params["dbUrl"] ) + "agtDereferenceXmlViewDataForDocumentCountReportNew?OpenAgent&viewName=vwExportCustomerProfileDataByDocidXml_customerProfile" + "&beginDate=" + params["beginDate"] + "&endDate=" + params["endDate"] + "&dataFieldName=" + params["demographicOne"] + "&dataColumn=1&derefKeywords=true&debug=false&rowCount=1000" );
connectionOne = urlOne.openConnection();
inpOne = connectionOne.getInputStream();
contentLengthOne = connectionOne.getContentLength();
bytesaOne = new ByteArrayOutputStream( contentLengthOne );
var cOne;
while((cOne = inpOne.read()) != -1)
{
bytesaOne.write( cOne );
}
inpOne.close();
mybytesOne = bytesaOne.toByteArray();
demographicOneInputStream = new ByteArrayInputStream( mybytesOne );
demographicOneInputStream.reset();
reportContext.getAppContext().put( "org.eclipse.datatools.enablement.oda.xml.inputStream", demographicOneInputStream );


Any chance I can run and debug your report?

BTW in 3.7.2 > finer cache control was added but I do not know it will help here.
http://www.eclipse.org/birt/phoenix/project/notable4.2.php#jump_11

Jason
Previous Topic:HTML output in DataItem using Java
Next Topic:BIRT Viewer - upgrade for IE8 +
Goto Forum:
  


Current Time: Thu Mar 28 11:03:53 GMT 2024

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

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

Back to the top