English 中文(简体)
WordPress RSS feed validation error
原标题:

I ve installed WordPress successfully but experiencing a RSS feed error.

I ve tried to edit files within the WordPress like wp-rss2.php so as to remove the ? from the first line but it does not resolve the error and I can t tell what is causing the error.

Here is the URL to my feed: http://www.donaha.sk/feed

How can I resolve this?

Please note: I had Slovak defined as language under Settings.

最佳回答

Your theme incorrrectly puts in an XML UTF declaration before the doctype in header.php:

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

according to [Invalid] Markup Validation of www.donaha.sk/ - W3C Markup Validator

Delete that and see if it fixes your UTF problems.

问题回答

Your feed starts with four (not one, not two, not three, but four :-) UTF-8 Byte Order Marks. Look:

C:	emp>od -c index.html.1
0000000 357 273 277 357 273 277 357 273 277 357 273 277   <   ?   x   m
0000020   l       v   e   r   s   i   o   n   =   "   1   .   0   "

You need to reduce that one or zero BOMs.

There s a chance that whatever editor you re using isn t showing them to you - try a different editor... I was able to remove them with SciTE by loading the file, hitting the Del key until the leading < disappeared, retyping that <, and saving the file. The resulting file then had a single BOM, and Firefox was then happy to load it.

Looks like there are some junk characters in front of the XML declaration. Try opening the file that generates it in something like Notepad++, put the cursor at the very beginning of the file and hit the back-space button a couple of times.

If you copy the XML source from your feed and paste it into Notepad++, you can see that the first character in the source has an odd dot in front of it. You can also see this in the error message Firefox generates when the feed is opened.

This is what is causing the error. You need to find where it is being printed and remove it, which is most likely at the very top of the PHP script that generates the feed.

Editing the core WP files was probably an incorrect move. This was possibly being caused by your theme or a plugin incorrectly sending characters at the wrong time. A default install of WordPress should cause no validation errors with the feed.

You may want to try undoing your changes to the WordPress core files and deactivate your plugins to see if that fixes it. Then you can re-enable them one by one to find the one causing the issue.

If the plugins aren t causing it then try activating the default theme and see if it is fixed then. If it is then it was your theme causing the issue.

Are you running WP in the root directory, or using one of the configurations to run the index at the root level as an illusion? If the latter, one of your plugins might be foolishly hard-coding a path to a core file that isn t there with your installation. And instead of spitting out data into the feed, it s spitting out nonsense.





相关问题
how to represent it in dtd?

I have two element action and guid. guid is a required field when action is add. but when action is del it will not appear in file. How to represent this in dtd ?

.Net application configuration add xml-data

I need to add xml-content to my application configuration file. Is there a way to add it directly to the appSettings section or do I need to implement a configSection? Is it possible to add the xml ...

XStream serializing collections

I have a class structure that I would like to serialize with Xstream. The root class contains a collection of other objects (of varying types). I would like to only serialize part of the objects that ...

MS Word splits words in its XML format

I have a Word 2003 document saved as a XML in WordProcessingML format. It contains few placeholders which will be dynamically replaced by an appropriate content. But, the problem is that Word ...

Merging an XML file with a list of changes

I have two XML files that are generated by another application I have no control over. The first is a settings file, and the second is a list of changes that should be applied to the first. Main ...

How do I check if a node has no siblings?

I have a org.w3c.dom.Node object. I would like to see if it has any other siblings. Here s what I have tried: Node sibling = node.getNextSibling(); if(sibling == null) return true; else ...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

热门标签