I get the following error from my rss feeds:

Invalid xml declaration.
Line: 13 Character: 3

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

You can find the feed at: http://www.urbanministry.org/rss.xml

I've cleared my cache using devel, and tried disabling any modules likely to cause problems, but still no luck. I've attached the modules we use.

Any ideas on what might be causing this?

CommentFileSizeAuthor
moduleslist.txt5.91 KBalsears

Comments

mo6’s picture

I'm also seeing this error (Drupal 5.2 / Views 5.x-1.6), it seems that there some extraneous newlines (6) are added before the xml declaration.

alsears’s picture

Any idea of how to remove the extra lines from the RSS feed? Is anyone looking into this since it looks like multiple people are having this issue?

mo6’s picture

After further investigation it turned out not to be an error in views in our case. The extra linefeeds where introduced by a custom module which included some .php modules/files by require/include. Each file/include entered an extra linefeed on each page, generated html or rss feed. By enclosing the includes in this module in a function (which is called when needed) the extra linefeeds disappeared and the rss feeds where clean again.

mo6’s picture

oops, %s/where/were/g

merlinofchaos’s picture

Status: Active » Closed (won't fix)

In general, if you're including PHP code, don't put the ?> at the end -- that'll prevent errors like this. If you're including HTML code, you should use ob_start and ob_end_clean to capture the output.