I am trying to generate jasper reports with Php using PhpJasperLibrary
. I am following this tutorial here at http://chathurangat.blogspot.com/2012/03/jasperreports-with-php.html. Reports are created with IReport Designer.
The problem is my IReport Designer creates and previews my testReport.jrxml perfectly with my data but when I follow the tutorial and goes to my browser to preview my report it gives empty document with nothing in it while my IReport Designer shows everything good with data and tables etc.
When I comment ini_set('display_errors', 0); It shows following errors.
Warning: simplexml_load_file(): reports/testReport.jrxml:1: parser error : Document is empty in C:\xampp\htdocseportviewer.php on line 23
Warning: simplexml_load_file(): in C:\xampp\htdocseportviewer.php on line 23
Warning: simplexml_load_file(): ^ in C:\xampp\htdocseportviewer.php on line 23
Warning: simplexml_load_file(): reports/testReport.jrxml:1: parser error : Start tag expected, '<' not found in C:\xampp\htdocseportviewer.php on line 23
Warning: simplexml_load_file(): in C:\xampp\htdocseportviewer.php on line 23
Warning: simplexml_load_file(): ^ in C:\xampp\htdocseportviewer.php on line 23
Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\phpjasperlibrary\PHPJasperXML.inc.php on line 109
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\phpjasperlibrary\PHPJasperXML.inc.php on line 665
Notice: Undefined property: PHPJasperXML::$arrayband in C:\xampp\htdocs\phpjasperlibrary\PHPJasperXML.inc.php on line 953
Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\phpjasperlibrary\PHPJasperXML.inc.php on line 953
TCPDF ERROR: Some data has already been output, can't send PDF file
What can be the problem? as I am following the above tutorial exactly so I might not post php code here except I changed following values.
$server="localhost";
$db="tcms";
$user="myUser";
$pass="abc123";
$version="0.8b";
$pgport=5432;
$pchartfolder="./class/pchart2";
$xml = simplexml_load_file("reports/testReport.jrxml");
Experts I need your suggestions please.
Well, from the stack trace, it seems that the file you're referencing (reports/testReport.jrxml) it's not there or it's empty, it may be that you need to give it a full path, or that your file path it's lacking something, i recommend you to try with:
./reports/testReport.jrxml
and see if it helps.
By the way, the latest version of the library you use (PHPJasperXML) can be found here: http://www.simitgroup.com/?q=PHPJasperXML