Subreport with XML-Datasource

High,

I have an Subreport from an XML-Source, it works alone without problems. But when I insert this as a Subreport to an other Report I become this message:

1286293 [mv_atos_part subreport filler] WARN query.JRXPathQueryExecuter - The supplied org.w3c.dom.Document object is null.

The Parentreport have the same XML-Source ( only an other XPATH Expression ) I have the option selected that the XPath expression from report should be used.

What is going wrong?

friendly greets to all other iReport-users
gombs's picture
656
Joined: Nov 14 2006 - 4:35pm
Last seen: 16 years 6 months ago

15 Answers:

there are 2 things you need to set when u add a subreport to a main.

1) the subreport connection expression. ie

((net.sf.jasperreports.engine.data.JRXmlDataSource) $P{REPORT_DATA_SOURCE}).dataSource("/Myxml/Data[Foo != '']")

NOTE the Xpath, this needs to point at your data.

2) the subreport expression. ie

"MySubreport.jasper"

This is the name of the compiled jasper subreport.

luck
walmillard
walmillard's picture
Joined: Jul 30 2006 - 11:53am
Last seen: 16 years 10 months ago
I use the wizard.

to 1)

The connection is the same like parentreport ( "$P{REPORT_CONNECTION}" ) .

The XPath from subreport is "/root/ATOS/Measure". It is valid, because as alone report it works fine, only not as a subreport.

To 2) The subreportexpression is valid to, i've selected from File-Browser and in all other cases it works.("mv_atos_part.jasper") I don't know whats the Problem....

:blush:
gombs's picture
656
Joined: Nov 14 2006 - 4:35pm
Last seen: 16 years 6 months ago
This is the XML-Data-Source:

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<root>
<ATOS>
<Atos-System-Typ>ATOS III Rev. 01</Atos-System-Typ>
<SNR-Sensor>D 06 043</SNR-Sensor>
<SN_ATOS_KameraLinks>181824506</SN_ATOS_KameraLinks>
<SN_ATOS_KameraRechts>185524706</SN_ATOS_KameraRechts>
<Measure id="1">
<Measuring_Volume>300x300</Measuring_Volume>
<Lens_Focal_MeasuringVolume_atos_Projektiv>12mm</Lens_Focal_MeasuringVolume_atos_Projektiv>
<Lens_Focal_MeasuringVolume_atos_ObjektivLinks>35mm</Lens_Focal_MeasuringVolume_atos_ObjektivLinks>
</Measure>
<Measure id="2">
<Measuring_Volume>150x150</Measuring_Volume>
<Lens_Focal_MeasuringVolume_atos_Projektiv>23mm</Lens_Focal_MeasuringVolume_atos_Projektiv>
<Lens_Focal_MeasuringVolume_atos_ObjektivLinks>65mm</Lens_Focal_MeasuringVolume_atos_ObjektivLinks>
</Measure>

<Profil>CFK 400</Profil>

<Typ>ROT640</Typ>

<Stativ_ATOS_Stativ>Foba AROBI</Stativ_ATOS_Stativ>
<High_ATOS_Stativ>2,0m</High_ATOS_Stativ>
<Arm0_ATOS_Stativ>1,7m</Arm0_ATOS_Stativ>
<Arm1_ATOS_Stativ>1,0m</Arm1_ATOS_Stativ>
</ATOS>
gombs's picture
656
Joined: Nov 14 2006 - 4:35pm
Last seen: 16 years 6 months ago
Post edited by: gombs, at: 2007/01/31 07:06

if I used the connection expression like this the subreport will empty too, but there are no message like my first post ((net.sf.jasperreports.engine.data.JRXmlDataSource) $P{REPORT_DATA_SOURCE}).dataSource("/users//templates/test.xml")

help plz :(
Post edited by: gombs, at: 2007/01/31 07:13
gombs's picture
656
Joined: Nov 14 2006 - 4:35pm
Last seen: 16 years 6 months ago
I post the files , first subreport:

[file name=mv_atos_part.jrxml size=4715]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/mv_...
Post edited by: gombs, at: 2007/01/31 11:44
gombs's picture
656
Joined: Nov 14 2006 - 4:35pm
Last seen: 16 years 6 months ago
the parentreport:

[file name=atos_xml.jrxml size=19058]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/ato...
gombs's picture
656
Joined: Nov 14 2006 - 4:35pm
Last seen: 16 years 6 months ago
and the datasource...

[file name=test.xml size=1156]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/tes...
gombs's picture
656
Joined: Nov 14 2006 - 4:35pm
Last seen: 16 years 6 months ago
and the datasource...

[file name=test-f1d0bd306c95c6992569042ea55f9bb4.xml size=1156]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/tes...
gombs's picture
656
Joined: Nov 14 2006 - 4:35pm
Last seen: 16 years 6 months ago
Maybe it is a general bug?

I had create a simple report with a simple XML-file as datasource and a parentreport where this report was insert and there was the same problem...the parentreport use the same data source, too:S
gombs's picture
656
Joined: Nov 14 2006 - 4:35pm
Last seen: 16 years 6 months ago
I think it is a generally JR problem, I've tested to fill in a java-app and get the same error.


Nobody has the same problem?
gombs's picture
656
Joined: Nov 14 2006 - 4:35pm
Last seen: 16 years 6 months ago
Hi, I have the same problem. But I am curious if somebody have the solution.
fero2's picture
99
Joined: Jan 30 2007 - 2:26am
Last seen: 16 years 4 months ago
I solved it. In subreport properties. U need to choose "Use data source expression". And then put inside $P{REPORT_DATA_SOURCE} or what ever u want. When u choose "Use connection expression" it is not working.
fero2's picture
99
Joined: Jan 30 2007 - 2:26am
Last seen: 16 years 4 months ago
Hi, I became a solution from iReport Master:

a Expression like this:

((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/root/Measure"))

will work, too B)
gombs's picture
656
Joined: Nov 14 2006 - 4:35pm
Last seen: 16 years 6 months ago
Ok in iReport it works fine.
But in a java app I get following error:

Error evaluating expression :
Source text : ((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/root/ARGUS")

What is wrong?
gombs's picture
656
Joined: Nov 14 2006 - 4:35pm
Last seen: 16 years 6 months ago
Could you please post your jasper report file?
andreas.daab's picture
Joined: May 9 2007 - 9:26pm
Last seen: 16 years 3 weeks ago
Feedback
randomness