Support » Plugin: XHTML Content Negotiation for WordPress » [Plugin: XHTML Content Negotiation for WordPress] XML Parsing Error: not well-formed

  • Since upgrading to WordPress 3.1, I’ve dound that I have to disable the XHTML content negotiation plugin that I was using, otherwise the pages fail to render in Firefox, coming ups with an error that says:
    XML Parsing Error: not well-formed… & then lists the line causing the problem (somewhere near the end of the pages code).

    As far as I can work out from having a quick look at the page source, this appears to be part of the code, that now creates the bar at the top of the page – in particular the part showing the site visitor stats.

    So its not really a problem with the XHTML content negotiation plugin – but more that running this highlights the badly formed XHTML code that is produced by WordPress / The site stats plugin.

    Has anyone else come across this problem? I tried fixing it by dropping from XHTML 1.1 to 1.0 transitional, but it seems that disabling the content negotiation plugin is the only way of making the pages render in Firefox.

Viewing 3 replies - 1 through 3 (of 3 total)
  • My feed produced the parsing error with 3.0.

    fixed it, (something with whitespace) but I see it’s returned with the upgrade to 3.1

    I don’t remember the fix (darn it) but when I do I’ll post it here.

    I am not sure the fault is purely your plugin’s …


    This is what worked for me just now

    In a nutshell,
    edit wp-includes/feed-rss2.php


    header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
    $more = 1;

    place this immediately after it

    $out = ob_get_contents();
    $out = str_replace(array("\n", "\r", "\t", " "), "", $input);

    Repeat with wp-includes/feed-rss2-comments.php

    I would suggest you check the source article, though — that’s where I copied the code that worked for me.

    Plugin Author Samir Shah


    Hi mat8iou,

    What theme are you using?

    Firefox will fall over if the page is not perfectly formed XHTML. This means that if your theme/ any plugins are using loose HTML/HTML5 (many new themes are using HTML5), then it will break.

    FWIW, my own recommendation (as author of the plugin) is to stop using XHTML and move to HTML5.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: XHTML Content Negotiation for WordPress] XML Parsing Error: not well-formed’ is closed to new replies.