giskard Posted August 24, 2011 Share Posted August 24, 2011 Hi guys, im totally new to ireport. I have read a few guides...but i cant find enough xml info as i would find on sql.My problem is a simple table. Im using the addressbook example as xml datasource. Im trying to display the attribute name in a table, but im getting null values, no matter what node I use ill get the same result, its kinda weird because I get the exactly number of rows in each node (for example is I use the xpath for name ill get 2, if I use the xpath for lastname ill get 4) but with null values.This is what im using for firstname: ((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).dataSource("/addressbook/category/person/firstname")What Im doing wrong? Thanks a lot!If you recommend a ireport guide for xmls it will help a lot :D Thanks again! Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted August 25, 2011 Share Posted August 25, 2011 First, given the number of questions on the topic, I have to absolutely find the time to write a good tutorial about using XML with iReport/Jaspersoft Studio and JasperReports. Anyway, let's say you have an xml of type:A+-- B +-- C +-- C +-- C+---B +-- C +-- C +-- CThe main xpath query should be /A/B so you can use each node B as record for the master report.For tables, list or subreports we want to print the C nodes of the current B node, so the datasource expression will be: $P{REPORT_DATA_SOURCE}).subDataSource("/B/C")in the context of the node B, creates a data source with elements of type /B/C For your reference: http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/data/JRXmlDataSource.html Giulio Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now