XMLReader->open()
Posted: Mon Jan 23, 2006 1:22 pm
Admin: You can close this if you'd like, I no longer need an answer.
OK so here's the relavent snippet of code:
The error I'm getting:
The docs for XMLReader says open() needs a URI. AFAIK that doesn't exclude local files. Nor would it make sense to. I tried an absolute path and everything. So then I switched things around:
Only to get a new error:
It seems like the problem lies in actually reading the file rather than any improper XMLReader usage. test.xml is not an empty file by any means. I'm stumped. 
OK so here's the relavent snippet of code:
Code: Select all
$file = 'data/test.xml';
$data = new xmlreader();
if($data->open($file) === FALSE) {
die('Unable to open file: '.$file);
}Code: Select all
PHP Warning: XMLReader::open(): Unable to open source data in C:\php5\apps\xmlReport\xmlReport.php on line 4
Unable to open file: C:\php5\apps\xmlReader\data\test.xmlCode: Select all
$file = 'C:/php5/apps/xmlReport/data/test.xml';
if($xml = file_get_contents($file) === FALSE) {
die('Unable to open file: '.$file);
}
$data = new xmlreader();
if($data->XML($xml) === FALSE) {
die('Unable to load XML Data.');
}Code: Select all
PHP Warning: XMLReader::XML(): Empty string supplied as input in C:\php5\apps\xmlReport\xmlReport.php on line 7
Unable to load XML Data.