PriteshP23 Posted August 2, 2013 Share Posted August 2, 2013 Hello, I am trying to read XML file and store in sql table. I got two errors. PHP Warning: XMLReader::open(): Unable to open source data Warning: XMLReader::read(): Load Data before trying to read How to solve it ? THANKS IN ADVANCED. $reader = new XMLReader; $reader->open('filename.xml'); while($reader->read()) { /// } Link to comment https://forums.phpfreaks.com/topic/280750-php-xml-error/ Share on other sites More sharing options...
Muddy_Funster Posted August 2, 2013 Share Posted August 2, 2013 Seriously? The line "XMLReader::open(): Unable to open source data" is there to to tell that the file is either not where you are teilling the script it is, does not exist at all, or does not have sufficient permissions set for the script to open it for reading. If the script can't open the file it's never going to manage to read it - hence the second warning message. Without information on your file structure that's all I got. Link to comment https://forums.phpfreaks.com/topic/280750-php-xml-error/#findComment-1443107 Share on other sites More sharing options...
PriteshP23 Posted August 2, 2013 Author Share Posted August 2, 2013 yes, i did. I have already checked the FILENAME and FILEPATH. Still it is not working. Link to comment https://forums.phpfreaks.com/topic/280750-php-xml-error/#findComment-1443114 Share on other sites More sharing options...
Muddy_Funster Posted August 2, 2013 Share Posted August 2, 2013 still need more info on the file structure.... Link to comment https://forums.phpfreaks.com/topic/280750-php-xml-error/#findComment-1443116 Share on other sites More sharing options...
PriteshP23 Posted August 2, 2013 Author Share Posted August 2, 2013 I think you are right. Please let me know the filename in below cases. case 1: $reader->open($topdir."/nap/".$code->no()."_city.xml"); IF i run like php user.php 01 php user.php case 2: $reader->open($topdir."/nap/"."01_city.xml"); IF i run like php user.php 01 php user.php I would like to know the working process. Link to comment https://forums.phpfreaks.com/topic/280750-php-xml-error/#findComment-1443117 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.