I have a XML String retrieved from a XML file. I can’t access the file directly using simplexml_load_file(). Reason is I have to get this through Amazon S3 getObject(). When I echo the string I can see the out put as a real XML file. But when I try to load it to a XML object using bellow code it doesn’t work. The variable $s3Data exactly contain the XML content in the given link.
$xml = simplexml_load_string($s3Data);
I need your help to figure this out. The XML string I am getting is available here.
http://mediatheques-aphp.bibliomedias.net/12.xml
EDIT
I created the XML string and tested. Now I get following errors. How can I fix these.
Warning: simplexml_load_string() [function.simplexml-load-string]:
Entity: line 12: parser error : Input is not proper UTF-8, indicate
encoding ! Bytes: 0xEF 0x76 0x65 0x3C in C:\Program
Files\Zend\Apache2\htdocs\voxmedia\application\modules\import\controllers\NaiveController.php
on line 1458Warning: simplexml_load_string() [function.simplexml-load-string]:
2009 naïve in C:\Program
Files\Zend\Apache2\htdocs\voxmedia\application\modules\import\controllers\NaiveController.php
on line 1458Warning: simplexml_load_string() [function.simplexml-load-string]: ^
in C:\Program
Files\Zend\Apache2\htdocs\voxmedia\application\modules\import\controllers\NaiveController.php
on line 1458
OK Now I feel the issue is with sort of string encoding or something. Is there any way to fix this?
Thanks.
I could find an answer to my question with a small workaround.
simplexml_load_string()continuously displayed encoding errors. So I usedsimplexml_load_file()as bellow. I’ve saved the file in to local location and then load withsimplexml_load_file().However still I don’t understan why
simplexml_load_string()couldn’t parse the same thing.