We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum


Thread tagged as: Question, Problem

RSS Validation (White Space?)

Hi Perchers,

I was validating my rss feeds and noticed the following error.

line 1, column 1: XML parsing error: <unknown>:1:1: XML or text declaration not at start of entity

Checking the feed I noticed a load of white space where xml version gets echoed out. See for yourselves: https://www.uk-cpi.com/careers/jobs/rss

I have gone through the code an made sure there is no white space before this line. This has me stumped and I wondered if anyone has ever had the same/similar issue?

Here is my code:

$domain = 'https://'.$_SERVER['HTTP_HOST'];
$url = $domain.$_SERVER["REQUEST_URI"];
PerchSystem::set_var('domain', $domain);
PerchSystem::set_var('url', $url);
header('Content-Type: application/rss+xml; charset=utf-8');
echo '<'.'?xml version="1.0" encoding="UTF-8" ?'.'>';
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
Dan Lee

Dan Lee 1 points

  • 1 year ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You have what looks like a tab character at the start.

Have you checked your config/config.php file to make sure it doesn't have any whitespace or an old fashioned closing ?> at the end?

Dan Lee

Dan Lee 1 points

Hi Drew,

I just checked the config file. I made sure to remove the end ?> and and whitespace. Still seem to be getting the problem. Is there any other files that would impact in a similar way to config.php?

Drew McLellan

Drew McLellan 2638 points
Perch Support

No core Perch files should be causing it provided that they've not been modified.