I am getting the above error - like many people and from searching google seems to be related to a space that is at the front of a file which may or may not even be in this module. No other module on the site has a problem and I would appreciate help in finding the cause.

Comments

dave reid’s picture

Status: Active » Postponed (maintainer needs more info)

It usually means you have some PHP file getting included that has an empty line before the opening PHP tag like the following:


<?php

Search for this and you'll find the cause. It's not the fault of XML sitemap module itself.

nick.thorley’s picture

Dave Reid

I read something similar but drupal has a masssive amount of php code and files and its like trying to find a needle in a haystack. Are you able to provide any suggestions of a command or method where I could at least narrow the issue down to a module or even better file. Bar going through each php file I cant see another way

Nick

dave reid’s picture

jlea9378’s picture

I encountered this same problem as well. I believe the problem was a bunch of blank lines at the end of my theme template.php.

gunnm’s picture

jlea9378 - you are a genius (not to belittle the other contributors on this page, but your comment is a life saver)! I've struggled with this problem for the past few hours, and the issue was indeed due to an empty line in my theme template.php. In my case the opening line was blank - removing the blank line solved the problem.

As a side point it is worth noting that as this is a relatively infrequent issue, it makes sense that it is not linked to a php issue with a common drupal module. Theme templates are an obvious variable between users.

michaellenahan’s picture

This excellent comment in the helped me to track down the problem on my site:

https://www.drupal.org/node/175137#comment-1526410

In your module.inc file (in the includes folder) add this after the drupal_load function in the module_load_all function

print $module.'|';

Reload the site in your browser. You will see a long list of modules.

Focus on the module which starts the second line in the list - in my case that was the module that was causing the problem.

alexander.nachev’s picture

Lovely :))). This helped me out find the damn SPACE in front of <?php that broke my xml. Thank you so much!!!