tags:

views:

20

answers:

1

If I visit the feed at

http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topalbums/sf=143444/limit=10/xml

with Firefox, it displays the feed as I would expect. But if I copy the source (view source) of this display and save it into a file like feed.xml on my local machine - it will not render the file but gives error:

XML Parsing Error: not well-formed Location: file:///C:/Program%20Files/xampp/htdocs/feed.xml Line Number 27, Column 48: 7.99

I can't understand why the exact same source will not work locally.

+1  A: 

When the feed is request from the web server a MIME type (in this case application/xml) is sent with the file which helps the browser to know how to display it.

When you load the file off disk, that information is not there, hence it will be displayed differently.

This doesn't explain your parsing error, but does explain why the feed is displayed differently.

Nick Jones
Ah.. is it possible to send the mime type as a php or html header in the file?
Mark Flint
Not easily - https://developer.mozilla.org/en/How_Mozilla_determines_MIME_Types#ExternalHelperAppService details for Firefox determines the Mime Type for files on disk
Nick Jones
But hang on... I'm viewing this file from my localhost directory (127.0.0.1) and I'm running Apache with the mime extention - all my other development files such as PHP are working - could there be another reason for the parsing error?
Mark Flint