2005 IR Help Posted September 1, 2006 Posted September 1, 2006 By: Vincenzo Amoruso - vinciamo XML Datasource XPath problem 2005-03-17 08:44 Hi! I'm trying to read some Rows in XML document using JRXmlDatasource (jasper)! But in the detail of report i can see only the first Row! ... <Doc> <Row> <Mytag>aaa</MyTag> </Row> <Row> <Mytag>bbbb</MyTag> </Row> </Doc> the Xpath selection writed in description of the field is '/Doc/Row/MyTag' I've tried all Xpath selection with no results! Thanks in advance! Regards Vincenzo! By: Friedemann Becker - fnbecker RE: XML Datasource XPath problem 2005-03-17 12:11 I think your Datasource should look like "sourcepath/Doc/Row", because it's the "Row" tag that's repeating, and your field descriptor should be "MyTag" By: Vincenzo Amoruso - vinciamo RE: XML Datasource XPath problem 2005-03-18 02:15 Thanks Friedemann! I've tried in your way but there's the same result! Could be possible that i need to create a subreport to viewing the rows detail! My report reads header tags and detail tags togheter! Thank! Vince! By: Friedemann Becker - fnbecker RE: XML Datasource XPath problem 2005-03-18 02:26 I always use subreports. try something like this: within the master report, in the subreport element set dataSourceExpression ((net.sf.jasperreports.engine.data.JRXmlDataSource) $P{REPORT_DATA_SOURCE}).dataSource("/Doc/Row") parametersMapExpression $P{REPORT_PARAMETERS_MAP} (this is optional, you will have the same parameters as in your master report) and your subReportExpression of course. in the subreport you will have to define a field with name mytag and description "MyTag", so you can write $F{mytag} for the field's contents try to use and modify the XML-Datasource example in the documentation, it has a master and a subreport, is quite simple, but has everything you will need to do pretty nice XML-Datasource things. By: Vincenzo Amoruso - vinciamo RE: XML Datasource XPath problem 2005-03-21 05:40 Thanks Friedemann! you were right! Using correct datasource Doc/Row my report now works! Thanks again! Vince!
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