Subscribe: RSS Feed XML error- any wrong? - Stack Overflow
http://stackoverflow.com/feeds/question/1486208
Added By: Feedage Forager Feedage Grade B rated
Language:
Tags:
answer  bom start  encoded bom  encoding  error wrong  error  feed xml  feed  file  iso  utf encoded  utf  wrong  xml error  xml 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: RSS Feed XML error- any wrong? - Stack Overflow

RSS Feed XML error- any wrong? - Stack Overflow



most recent 30 from stackoverflow.com



Updated: 2018-02-26T04:21:50Z

 



RSS Feed XML error- any wrong?

2009-09-28T10:18:28Z

XML Parsing Error: no element found
Location: http://localhost/rss/
Line Number 1, Column 1:

However, when I paste the xml into http://validator.w3.org/feed/check.cgi , it say no formatting error.

FULL CODE AT BELOW:

index.php


            
                
                            hehe
                            http://www.google.com
                            gaga
                
            
            ';
echo $details;

?>



Answer by ingorichter for RSS Feed XML error- any wrong?

2009-09-28T10:07:44Z

Who is reporting the Parsing Error? I put the code on my machine and it worked as expected. Firefox asked to subscribe to the feed.




Answer by Fenton for RSS Feed XML error- any wrong?

2009-09-28T10:08:00Z

You have to be really careful to ensure there are no line breaks or white space before the XML declaration. Even a single line break will cause problems.




Answer by bobince for RSS Feed XML error- any wrong?

2009-09-28T10:18:28Z

Make sure you haven't got a stray BOM at the start of your PHP file. Some (stupid, broken) editors on Windows will drop a UTF-8-encoded BOM onto the start of a file when saving as UTF-8. This is pointless (as UTF-8 does not have byte order issues) and undesirable (as it will break compatibility with byte-oriented processing tools).

Since you are serving your output as ISO-8859-1, any UTF-8-encoded BOM at the start becomes the 8859-1 sequence . For XML this would be non-whitespace character data outside the root element, which isn't allowed.

If this is what's happening, fix it by saving your PHP file as ‘Western’ (cp1252) encoding, or look for a ‘UTF-8 without BOM’ encoding to save under.