Hi,
Just tried the rss feed with my new drupal installation. In IE, it says when I try to load the feed: "Internet Explorer cannot display this feed - This feed contains code errors."
In Drupal, when I click on the rss button (frontpage), the following is displayed:

<?xml version="1.0" encoding="utf-8"?>


... blah blah blah

Important detail: Something that seems to be two dots is displayed before the <?xml tag. Interestingly, the copy-paste operation does not include the two dots.
Are they the source of the problem? Someone could tell me the reason of this rss error?
Thank you.

Comments

HenryLTV’s picture

I'm having the same issue with Drupal 6 & IE as well. "Internet Explorer cannot display this feed. This feed contains code errors." It complains about Invalid xml declaration. Line: 2 Character: 3

<?xml version="1.0" encoding="utf-8"?>

When I view the source, Line 1 seems to be a box (carriage return perhaps), but i'm not sure this is the cause.

Does anyone have any insight into fixing this?

Unfortunately geantbrun, of the comments and posts asking for help i've made thus far, not ONE of them have been even REPLIED to let alone answered. One of the reasons why I chose Drupal in the first place was because I had heard how helpful the community was, but apparently this fact was overstated in attaining help from the Drupal Forums as i've had 0% success thus far. I've gotten somewhat better success getting help using Drupal IRC.

geantbrun’s picture

Thank you for you answer. Even it does not solve my problem, now I know that I'm not alone!
By curiosity, is your site in english? Does it use accents?
To determine what are the characters at the beginning of the file, you can save your file and examine the contents in an hexadecimal editor. Is the beginning the BOM character? (see http://en.wikipedia.org/wiki/Byte_order_mark)
regards,
Patrick

David McMurray’s picture

I'm getting the same issue. Viewing the source in IE shows two blank lines at the top before the starting XML tag. These blank lines are created by 4 ASCII characters 13, 10, 13, 10 (or 2 carriage return / line feeds).

Viewing this in Firefox was no better, it just rendered the XML as if it was HTML. So it rendered the contents of the feeds LINK tag, then the first items LINK tag and then displayed the contents of the description which was encoded HTML, so it was shown as actual HTML code on the page. E.g.

http://www.mydomain.com  en  http://www.mydomain.com/node/11 <div class="field field-type-filefield field-field-blogimage">  <div class="field-items">  <div class="field-item odd">  <div class="filefield-file clear-block"><div class="filefield-icon field-icon-image-jpeg"><img class="field-icon-image-jpeg" alt="image/jpeg icon" src="http://www.mydomain.com/sites/all/modules/filefield/icons/protocons/16x16/mimetypes/image-x-generic.png" /></div><a href="http://www.mydomain.com/sites/default/files/type/nid/pic1.jpg" type="image/jpeg; length=21387" title="pic1.jpg">This won&#039;t work properly</a></div> </div>  </div> </div> ...

This is the source for the above (note there should be 2 blank lines at the top of the following code, but they won't show here)...



<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.mydomain.com"  xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>www.mydomain.com</title>
 <link>http://www.mydomain.com</link>
 <description></description>
 <language>en</language>
<item>
 <title>Capital loss</title>
 <link>http://www.mydomain.com/node/11</link>
 <description>&lt;div class=&quot;field field-type-filefield field-field-blogimage&quot;&gt;
    &lt;div class=&quot;field-items&quot;&gt;
            &lt;div class=&quot;field-item odd&quot;&gt;
                    &lt;div class=&quot;filefield-file clear-block&quot;&gt;&lt;div class=&quot;filefield-icon field-icon-image-jpeg&quot;&gt;&lt;img class=&quot;field-icon-image-jpeg&quot;  alt=&quot;image/jpeg icon&quot; src=&quot;http://www.mydomain.com/sites/all/modules/filefield/icons/protocons/16x16/mimetypes/image-x-generic.png&quot; /&gt;&lt;/div&gt;&lt;a href=&quot;http://www.mydomain.com/sites/default/files/type/nid/pic1.jpg&quot; type=&quot;image/jpeg; length=21387&quot; title=&quot;pic1.jpg&quot;&gt;This won&amp;#039;t work properly&lt;/a&gt;&lt;/div&gt;        &lt;/div&gt;
        &lt;/div&gt;
&lt;/div&gt;
greggles’s picture

This has happened to a site I work on as well.

There are 9 "blank" lines at the top of the file, some of which have spaces or tabs on them, and then the xml declaration comes.

IE throws an error instead of just ignoring the whitespace.

When I use the w3c feed validator indeed it appears that an xml document is not allowed to start with whitespace.

To debug this, I suggest switching themes to see if that fixes it. If so, start looking through any views theme override files/functions and remove any whitespace that they might be printing.

If that doesn't solve it, the next step is to start disabling modules until the problem goes away.

greggles’s picture

As has been noted, removing a ?> from the end of your template.php file can help.

In my case it was a bunch of whitespace in between php in some of the tpl.php files. Files like this (including the leading and trailing new lines):


 <?php if ($some_variable):
    <div class="another-div"><?php print $something; ?></div>
 <?php endif; ?>


Removing the extra whitespace fixed the problem.

rommyusa’s picture

Had the same problem, I found a solution here:
http://drupal.org/node/175137

Removing the php closing tag "?>" from my template.php did the trick.

xjessie007’s picture

Here is a "how to" that explains how to find the code that causes a blank line at the beginning of your XML file making it invalid.

Drupal - blank line at the beginning of a page
http://drupal.org/node/175137#comment-3488704

armyofda12mnkeys’s picture

I had same issue in IE... I had a podcast View i created and the IE page showed this error...
I had pretty much the defaults used as my template in Contemplate settings (no ?> at the end so i was stumped)... I figured if my feed was empty, IE didnt like the empty feed unlike other browsers, and gave this error... Adding at least one item to the feed/view 'fixed' the problem.