Jump to content
We've recently updated our Privacy Statement, available here ×

XML instead of Database


Recommended Posts

By: Gopalakrishnan - gopkrish3

XML instead of Database

2004-07-07 03:51

Hai

Is it possible to read data from XML instead of database and create report using iReport. If it is possible can any one provide some detailed information how to do it.

 

Thanks

T.Gopalakrishnan

 

 

By: Giulio Toffoli - gt78

RE: XML instead of Database

2004-07-07 17:42

 

Go here. It's really fresh and available from repository:

 

http://ireport.sourceforge.net/cap7.html

 

and

 

http://sourceforge.net/tracker/index.php?func=detail&aid=986778&group_id=36382&atid=416705

 

Giulio

 

 

By: Gopalakrishnan - gopkrish3

RE: XML instead of Database

2004-07-07 23:16

Thanks Giulio

I tried to create an XML datasource but i can't able to succeed. I can't able to save the datasource. If i click the save button the popup is dismissed but it is not displayed in the list of data sources

I am using iReport-0.3.1 version.

 

Pls help me to resolve this

 

Thanks

T.Gopalakrishnan

 

 

By: LL - lovelyliatroim

RE: XML instead of Database

2004-07-09 02:13

Hey lads,

Giulio Ive being looking at example on http://ireport.sourceforge.net/cap7.html for using JRXMLDataSource, do you have the "/addressbook.jasper" file so i can run this example!! Just new to ireport, Jasper etc etc so just getting a feel for it, need to create reports from querying a DOM Tree and have looked at your example above!! Just wondering what the addressbook.jasper looks like!! Would be a gift if i could download that whole example and run it!!

 

 

Just another thing, i see that this JRXMLDataSource is new, very new, what way have people being making reports before this?? i.e Quering XML rather than a DB to generate reports??

 

cheers,

LL

 

 

By: Giulio Toffoli - gt78

RE: XML instead of Database

2004-07-09 15:14

 

There was no other way.

 

All .jasper are presents in http://sourceforge.net/tracker/download.php?group_id=36382&atid=416705&file_id=93174&aid=986778

 

 

Giulio

 

 

By: LL - lovelyliatroim

RE: XML instead of Database

2004-07-12 03:18

Cheers Giulio, will have a look at it!!

 

 

By: LL - lovelyliatroim

RE: XML instead of Database

2004-07-19 02:35

Hey Giulio, just getting around to looking at it now, is there a way to specify parameters, like take for example of in your addressbook example you only want to see the person with the id=3, and this value is set at run time!!

 

Can this be done?? and if so how?

 

 

By: Giulio Toffoli - gt78

RE: XML instead of Database

2004-07-19 03:15

This kind of filter must be done by yourself, i.e.

setting a printWhenExpression like this in your

detail band:

 

new Boolean( ${ID}.intValue() == 3)

 

Giulio

 

 

By: LL - lovelyliatroim

RE: XML instead of Database

2004-07-26 04:05

Cheers for that Giulio, only getting back to this now!! Im having a problem with the record level or maybe im just not getting the bigger picture!! i have a simple XML file like this

<client>

<Accounts>

<node type="Account">

<property id="Balance" value="300"/>

</node>

<node type="Account" >

<property id="Balance" value="100"/>

</node>

</Accounts>

</client>

 

now all i want to do is print the type, so i have set up a report field called "Type" and the field description is

/client/Accounts/node@type, now this is in the detail band in my report!! Now this should give me a report which just prints

Account

Account

now the interesting thing here that happens is when i have set the record path to be "/client/" all i get as output is just one record, if doesnt print the second or third(if there was), now if i set the record path to be /client/Accounts/ i now get the desired effect, 2 records are printed!! Now problem is, i dont want the record level to be /client/Accounts/, i need it to be /client/!!

Now i notice in the example you dont have a "/" at the end of your record path, if i dont include the "/" i just the first record, e.g "/client/Accounts" gets me one record, "/client/Accounts/" gets me 2, the desired effect!!

 

any ideas at all??? really weird, example works fine but im at a loss as to what it can be!!

 

thanks for the help Giulio, appreciate it!!

 

 

 

By: LL - lovelyliatroim

RE: XML instead of Database

2004-07-26 07:23

Just to follow up from my digging around, if you take the address book example and set the record path from "/addressbook/category/person" to just "/addressbook" the report is then broken!! Should this be happening??

 

On a totally different note, came across this on my getting to grips with ireport, i went to Tools, Options, Compiler and set the compiler directory and clicked Save, and wooooooooo, using 0.3.2!! using jdk 1.4.2_02, hard to explain in words what happens!!

 

cheers LL

 

 

By: LL - lovelyliatroim

RE: XML instead of Database

2004-07-28 00:45

right heres what i found, have being having a look at the source ;)!! take for example the following XML snippet

<client>

<Accounts>

<node type="Account">

<property id="Balance" value="300"/>

</node>

<node type="Account" >

<property id="Balance" value="100"/>

</node>

<node type="Account" >

<property id="Balance" value="200"/>

</node>

</Accounts>

</client>

 

now in our report we have a field with the following field description,

/client/Accounts/node/property@vaue

so essentially all we are doing is showing the values in the following XML snippet!! Now if you set the record path to be /client/Accounts/node our query will work fine, but if you set it to /client/Accounts it wont work!! Now heres where i have seen the problem is, in the data source on the next() method call, i.e we are asking the datasource is there another record, now in here we call rootFieldNode.next( this.rowPath ), now the problem here is the value of rowPath, rowPath is set to the record path i.e /client/Accounts, we want the rowpath to be the current path we are looking for, which is /client/Accounts/node/property@value!! so made a simple little adjustment in the the getFieldValue method(), just added one line

 

this.rowPath = path;

Object val = getPathValue(rootFieldNode, path);

where path is the current field description!! Now this might have a knock on effect(one because i dont know the source codes ins and outs, just being looking at the mechanics for the XMLDatasource) but if you take the example given with the XMLDatasource and set the record path to "/addressbook" there seems to be no problem!!

 

if i get any strange knock on effects will post!!

 

cheers,

LL

 

 

By: LL - lovelyliatroim

RE: XML instead of Database

2004-07-28 02:50

Just another follow up, another bug me thinks,

in the getPathValue method,

take following scenario

<client>

<Larry>

<node>

<pop id="ID" value="Shouldnt See"/>

</node>

</Larry>

<Accounts>

<node type="Account">

<property id="Balance" value="300"/>

</node>

<node type="Account" >

<property id="Balance" value="100"/>

</node>

<node type="Account" >

<property id="Balance" value="200"/>

</node>

</Accounts>

</client>

 

the field description is set to

/client/Accounts/node/property@value

Now in the report you shouldnt see /client/larry/node/property@value, but you do!!!

stems from the fact that in the getPathValue method, the last line of code

return getPathValue(startingNode.getNextChild(), path );

 

its the getNextChild, we are just getting the next child and not checking to see if this child is the one we want!!

 

thats the latest on it..............

 

 

By: LL - lovelyliatroim

RE: XML instead of Database

2004-07-30 01:59

Giulio whats the status on this, is it going to be addressed or dropped?? have dropped using the XML datasource and came up with a custom datasource to suit my needs but ideally would opt for the XML datasource!! things getting very hairy when it comes down to the indexing!!

is the xml datasource going to be addressed?? if so any idea on a time frame??

 

 

By: Giulio Toffoli - gt78

RE: XML instead of Database

2004-07-30 04:56

 

jasperreports 0.6.0 provide a new JRXmlDataSource that works in a similar way and is based to XPath. iReport will switch to this implementation.

 

Giulio

 

 

By: LL - lovelyliatroim

RE: XML instead of Database

2004-07-30 06:59

Cheers Giulio, will have a look at that!!

 

 

By: irajiafo - irajiaf

RE: XML instead of Database

2004-08-11 01:07

Hi Giulio,

 

could you please tell me when iReport is going to switch to the implementation of the JRXmlDataSource of jasperreports 0.6.0, will it than be possible to use a short record path like  /addressbook ?

 

thanks

Mike

 

 

By: Giulio Toffoli - gt78

RE: XML instead of Database

2004-08-17 14:25

 

From the next version will be used JRXMLDataSource from JR 0.6.0

 

(half/end of september)

 

Giulio

 

 

By: 123kid - kid123

RE: XML instead of Database

2004-09-06 05:11

Hallo LL,

 

how to make the fields appear/enter in the lower half of the report query-window? The thing is, I tried a xml-datasourced report starting from the scratch on my own but can't define the field-list (when I load the ex the list is allready filled).

 

Ge

 

 

By: LL - lovelyliatroim

RE: XML instead of Database

2004-09-07 07:23

Im a bit lost at what you trying to achieve here,

"how to make the fields appear/enter in the lower half of the report query-window?", i dont get you here at all, can you be more clearer as to what you want!!

 

first things first, i hope your using the japser reports XML data source that comes with 0.60?? not the one that comes with ireport??

Secondly have you taken a look at the example of the XML data source shipped with japser???

 

 

 

By: Gopalakrishnan - gopkrish3

RE: XML instead of Database

2004-09-15 23:26

Is it possible to use the same jrxml with both XML datasource and database connection.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...