• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Jasper Report :Document root element "jasperReport", must match DOCTYPE root "null".

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Here is my JRXML code :



<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="C1" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="3835481c-be85-4ed0-89fa-25b226d4711f">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="137"/>
<parameter name="custTitle" class="java.lang.String"/>
<parameter name="custFullname" class="java.lang.String"/>
<parameter name="address1" class="java.lang.String"/>
<parameter name="address2" class="java.lang.String"/>
<parameter name="address3" class="java.lang.String"/>
<parameter name="custCity" class="java.lang.String"/>
<parameter name="pinCode" class="java.lang.String"/>
<parameter name="amount" class="java.lang.String"/>
<parameter name="SRDate" class="java.lang.String"/>
<parameter name="SRNumber" class="java.lang.String"/>
<parameter name="cardNumber" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<summary>
<band height="661" splitType="Stretch">
<staticText>
<reportElement uuid="7d0bb114-b36e-441a-9c8b-86d4fe7a5936" x="0" y="0" width="555" height="160"/>
<textElement/>
<text><![CDATA[
...................................................
..........................
...............
</jasperReport>


and this is how i am generating report using code :


JasperReport jasperReport = null;
JasperDesign jasperDesign = null;
Map parameters = new HashMap();
parameters.put("custTitle","Mr.");
parameters.put("custFullname","ABC");
parameters.put("address1","DEF");
parameters.put("address2","XYZ");
parameters.put("address3","POIU");
parameters.put("custCity","Asdf");
String path = getServletContext().getRealPath("/WEB-INF/");
jasperDesign = JRXmlLoader.load("path of jrxml file//C1.jrxml");

jasperReport = JasperCompileManager.compileReport(jasperDesign);
byte[] byteStream = JasperRunManager.runReportToPdf(jasperReport, parameters, conn);
// byte[] byteStream = JasperRunManager.runReportToPdf(jasperReport, parameters);
OutputStream outStream = response.getOutputStream();
response.setHeader("Content-Disposition","inline, filename=myReport.pdf");
response.setContentType("application/pdf");
response.setContentLength(byteStream.length);
outStream.write(byteStream,0,byteStream.length);



it is compiling fine and while generating through iReport also it is getting generated
but while generating through front end it showing me error :

ERROR [Digester] Parse Error at line 2 column 447: Document root element "jasperReport", must match DOCTYPE root "null".
org.xml.sax.SAXParseException: Document root element "jasperReport", must match DOCTYPE root "null".

I searched in many forums also but it showing version might be different then i compiled with same version also but then also it shows the same error, so please help me out of this....
Please tell me where i am wrong...


Thanks in Advance,
Karthik G.














 
Bartender
Posts: 3648
16
Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Line 2 of the jrxml looks fine. Yet you ought to use language="java" rather than 'groovy".

Regarding your exception, what version of Jasper Report are you using? What jar file is in the webapp's lib folder? The jar file version needs to match the Jasper (client) version.
 
karthik swamy
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iused jasperreports-5.1.0.jar to generate jrxml file and put the same jar file in WEb-INF folder of .war file and it got compiled also and as per above instruction i changed the language to java but it throws the same error...
and I am littlt bit confuse in the statement " The jar file version needs to match the Jasper (client) version." As I am new to this tell me what is Jasper (client) version.


Regards,
Karthik G.
 
K. Tsang
Bartender
Posts: 3648
16
Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Jasper client is the software you use to build those jrxml files like through drap and drop.
 
Those cherries would go best on cherry cheesecake. Don't put those cherries on this tiny ad:
professionally read, modify and write PDF files from Java
https://products.aspose.com/pdf/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!