I noticed the following error message while checking RSS feeds belongs to a client.
XML Parsing Error: XML or text declaration not at start of entity Location: http://www.domain.com/file.rss Line Number 2, Column 1:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> ^
This is what the XML output:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <result> <name>Ron Weasley</name> <class>8</class> <pass>yes</pass> </result>
Notice the extra white line just before the <?xml". That was the cause of the error message.
Remove the extra white line, you are ready to roll :-)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <result> <name>Ron Weasley</name> <class>8</class> <pass>yes</pass> </result>
This book might help: Professional XML (Programmer to Programmer)
If you enjoyed this post, make sure you subscribe to our
Comments
I got the same XML Parsing Error when I worked on a listing page using xml. I have solved this issue by adding an "ob_start();" at the top of the page and "ob_end_clean();" above the xml header part. like
ob_end_clean();
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"");
header("Last-Modified:". gmdate( 'D, d M Y H:i:s' ) . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-type: text/xml; charset=utf-8");
$xml = "\n";
That solved my issue.
Post new comment