My blog feed show error today:
This page contains the following errors:
error on line 2 at column 6: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error
My blog feed: http://feeds.feedburner.com/klassicblog
My blog: http://blog.klassicweb.com
A well-formed XML document entity always has "<" as its first non-whitespace character. A well-formed external general parsed entity need not start with "<". So if by "a XML" you mean "a well-formed XML document entity", then the answer is "no".
Rules. If the XML declaration is present in the XML, it must be placed as the first line in the XML document. If the XML declaration is included, it must contain version number attribute. The Parameter names and values are case-sensitive.
The XML Declaration provides basic information about the format for the rest of the XML document. It takes the form of a Processing Instruction and can have the attributes version, encoding and standalone.
Here is the solution I found First you create a php file (whitespacefix.php) on the wordpress root dictory with following content.
<?php
function ___wejns_wp_whitespace_fix($input) {
$allowed = false;
$found = false;
foreach (headers_list() as $header) {
if (preg_match("/^content-type:\\s+(text\\/|application\\/((xhtml|atom|rss)\\+xml|xml))/i", $header)) {
$allowed = true;
}
if (preg_match("/^content-type:\\s+/i", $header)) {
$found = true;
}
}
if ($allowed || !$found) {
return preg_replace("/\\A\\s*/m", "", $input);
} else {
return $input;
}
}
ob_start("___wejns_wp_whitespace_fix");
?>
Then open the index.php file and add the following line right after <?php
tag
include('whitespacefix.php');
Referenced from here
Your xml document starts with a new-line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With