mark5009 Posted August 29, 2007 Share Posted August 29, 2007 Hi .. I am trying to get going using iReports 2.0.1 and an XML data source and not having much joy. Any help would be appreciated. The steps I am taking are: 1. Data/Connections/New Select 'foo.xml' Select "Use the report XPath.." Test (successful) 2. Data/Report Query Query language = XPath Enter expression: '/FooReport/header' Click 'Read Fields' And I get nothing back! So, I am clearly doing something very basic wrong. Any help grateful accepted.TIA mark Here is the XML of the report: <?xml version="1.0"?><FooReport> <header> <UserId>Bob Bobson</UserId> <SessionId>456789</SessionId> <Site>Internet</Site> <Intro>Lorem ipsum dolor sit amet</Intro> </header> <body> </body></FooReport> Link to comment Share on other sites More sharing options...
nitin403 Posted August 29, 2007 Share Posted August 29, 2007 Hi! mark5009You choose xml as Datasource and same as active Datasource I assume.In the right sidebar of Data/Report Query you will see your Datasource.Just Drag the required node the field name section.Then use it as field. Link to comment Share on other sites More sharing options...
berlim Posted August 29, 2007 Share Posted August 29, 2007 I don't think xpath works properly, or at least I had the same problem of you. To fix this: Set the expression instead of using xpath.Your expression would be:/FooReport/header Then the xpath query will work. Hope that solves it! Link to comment Share on other sites More sharing options...
mark5009 Posted August 29, 2007 Author Share Posted August 29, 2007 Thanks, for your prompt help, guys, but I must be thick today .. :) berlim, I tried your suggestion of putting the expression into the data source expression. I then assume that I go into 'Data/Report Query', select 'XPath' and enter a value of '/' as the query? If I do that or explictly set the field name, like '/UserId' I still see nothing in the Fields section. Also, I have 'Auto Retreive Fields' off and am doing a maual fetch. Doesn't make a difference. nitin, Ummm .. what sidebar? I can't seem to get fields from anywhere! Additionally, Here is the bit from the .jrxml file <queryString><![CDATA[/FooReport/header]]></queryString> And that seems to be okay. Is there a differnce between the 'XPath' and 'xpath2' query languages? I assume that 'XPath' is just 1.0 and 'xpath2' will do both? Thanks again. Still more help needed! 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