correo.luis.vg Posted July 21, 2016 Share Posted July 21, 2016 Hello,Im trying to call rest_v2, using xmlString as DataSource which fill the report in PDF. The MainReport works, but using subreport throw errors. like XML parse, or just returning Blank subReports. This is the correct way to fill subreports from xml string in rest?, any ideas of what im doing wrong?I have this Lines in the MainReport:<parameter name="xmlString" class="java.lang.String"> <defaultValueExpression><![CDATA["<?xml version=1.0" encoding="UTF-8"?><Report><Test><name>a</name><percent>123</percent></Test></Report>]]></defaultValueExpression></parameter><parameter name="XML_INPUT_STREAM" class="java.io.InputStream"> <defaultValueExpression><![CDATA[new java.io.ByteArrayInputStream($P{xmlString}.getBytes("UTF-8"))]]></defaultValueExpression></parameter><queryString language="xPath"> <![CDATA[/Report]]></queryString> One of the subreports, have a Pie 3D chart, this is the code<parameter name="xmlString" class="java.lang.String"> <defaultValueExpression><![CDATA["<?xml version=1.0" encoding="UTF-8"?><Report><Test><name>a</name><percent>123</percent></Test></Report>]]></defaultValueExpression></parameter><parameter name="XML_INPUT_STREAM" class="java.io.InputStream"> <defaultValueExpression><![CDATA[new java.io.ByteArrayInputStream($P{xmlString}.getBytes("UTF-8"))]]></defaultValueExpression></parameter><queryString language="xPath"> <![CDATA[/Report/ResMediosGraficos/tipo]]></queryString><field name="Naturaleza" class="java.lang.String"> <fieldDescription><![CDATA[name]]></fieldDescription></field><field name="Porcentaje" class="java.lang.Integer"> <!-- Numeric for Chart --> <fieldDescription><![CDATA[percent]]></fieldDescription></field>this is declaration of subReport 1 in Main jrxml file. <subreport> <reportElement x="0" y="0" width="510" height="30" uuid="21e18f03-e63f-4294-9462-b1a56a67ad81"/> <subreportParameter name="xmlString"> <subreportParameterExpression><![CDATA[$P{xmlString}]]></subreportParameterExpression> </subreportParameter> <subreportExpression><![CDATA["chart.jrxml"]]></subreportExpression></subreport> Thanks you very much, any help will be appreciated [sOLVED]I couldnt find the reason, but just changing the Detail Band for these two reports has solved the problem :D. Greetings !! Link to comment Share on other sites More sharing options...
correo.luis.vg Posted July 21, 2016 Author Share Posted July 21, 2016 I made some test, There is 5 subreports which fill the main report. Now, the three first reports are working perfectly, but in the 4th and the 5th jasperserver says "Fail to parse the xml document", when i launch the main report. But if i publish the 4th and the 5th separately it works perfectly. If i remove these reports from the main, i got no errors =(. Any ideas? ( two of the five subreports, got int fields, one of them is working ) Thank you, 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