The other day I encountered “XML Parsing Error: XML or Text Declaration Not at Start of Entity” error when I accessed Globinch blog RSS Feed. Till the previous day everything was OK. Because of this error Globinch Feedburner feed got problems and was not delivering the daily updates to the readers. It took me almost 12 hours to fix this.
Why : XML Parsing Error: XML or Text Declaration Not at Start of Entity
In a well formed XML the XML Prolog (starts with “<?xml … ?>”), if present, should be the first entry of the file. There should not be any blank line before the XML Prolog. So if you have a blank line just before the “<?xml version=”1.0″ encoding=”UTF-8″?>” You will encounter the above error. See the screen shot below.
I searched many blogs and discussion forums. Most of them suggested to check the “wp-includes/feed-*” files for blank lines. I checked all those files and uploaded if necessary. Some blogs suggested to add some scripts which will remove the new line and tab characters from the generated string. I tried all these but the RSS error was still there.
Fix for XML Parsing Error
The question is who or which script file is introducing the blank line in the RSS XML? Unfortunately it is very easy to introduce that bug in PHP. If any of your PHP file (may not be directly related to feed) has a blank line before or after (outside) bracketed sections (<?php and after ?>) causes the issue.
This can introduce the blank line in the feed RSS.
1. Using WordPress plug-ins
- Download the plugin from above download link.
- Unzip and upload it to /wp-content/plugins directory.
- Change the permission of your all .php files to “777″ for time being.This will help the plugin to remove the blank lines from the files if the files are writable.
- Go to your dashboard and activate the plugin and follow the instructions to scan the files and to fix the blank lines.
- Once the process is over change the permission of all the .php files back to the original (“755″).
I tried this solution, unfortunately in my case this plugin didn’t help me. It did removed many spaces in many .php files but the RSS error was still there.
2. Deactivate your plug-ins one by one
This is the second step I tried. It was suggested in many blogs and forums. I deactivated each plugin and checked and activated them again. But this procedure also did not help me.
3. Check your files manually.The final solution
Finally I tried another approach. I sorted all my .php files which I had changed in the last two days. I found that only one file I changed, It was functions.php in my themes folder. I check for blank lines, there were none. Finally I found that there is a space after one “?> “ php close tag. Removed it and uploaded the file using FTP. Checked the RSS Feed. It was perfect!
So you can try all these options. Find out the PHP files which you changed just before you encountered this error and remove any blank lines or space in that file before .
Join Globinch on Social Media
- Turn your Windows 7 Computer Into a Personal Wi-Fi Hotspot 20 comment(s) | 26,798 view(s)
- Search Engines for File Sharing Sites : Rapidshare Search, Megaupload and More 2 comment(s) | 18,490 view(s)
- Google Translate Now supports Bengali, Gujarati, Kannada, Tamil and Telugu 2 comment(s) | 17,373 view(s)
- Best PDF OCR Tools to Convert Scanned images to Text / Word Documents 4 comment(s) | 13,751 view(s)
- Google Top Searches Today – Hot Google Search Words today 8 comment(s) | 13,529 view(s)
- Globinch Search 0 comment(s) | 10,429 view(s)
- Access Blocked sites, Unblock Restricted Websites 16 comment(s) | 9,473 view(s)
- Password Revealer – How To Reveal- Show Password Behind Asterisks? 1 comment(s) | 8,523 view(s)
- Play Angry Birds Game Free and Offline in Chrome Browser 1 comment(s) | 8,254 view(s)
- Free Online OCR Software to Convert Images Into Searchable PDF, Doc, HTML or Text 2 comment(s) | 8,092 view(s)
- Samsung Galaxy Core Features, Specs, Price
- How to Use Wi-Fi the Secure Way
- 5 Apps to Boost Android Performance
- Building a Smarter Site Using a WordPress Platform
- Samsung Galaxy S IV Smartphone :Summary of All the Radical Innovations
- 5 Killer Tips to Increase Traffic to Your Blog
- Domain Parking to Make Genuine Money Online
- SEO Is Not Dead, But You Need to Upgrade The Process
- A Complete SEO Guide on Using Social Media for Better SERPs
- When Should You Use Geotargeting or Setting Geographic Target in Google Webmaster Tools?