PageSpeed causes my page to display an XML Parsing Error message Print

This usually happens when using a content management or generation system (we've seen it with Munin and Magento for example). The full error message looks something like:

XML Parsing Error: mismatched tag. Expected: </li>.
Line Number 123, Column 4: </ul>

This happens when the generated content has a meta tag that identifies the content as XHTML but the content has markup that is not valid XHTML, and you have configured your webserver to set the content type to HTML, so the browser parses it as HTML and doesn't detect the invalid XHTML errors.

However, when convert_meta_tags is enabled (and it's a core filter so is on by default), PageSpeed inserts a content header into the response with the value in the meta tag, namely XHTML (application/xhtml+xml to be precise), resulting in the browser displaying the error message because it is now parsing the page as XHTML and it rejects the invalid content.

There are three solutions, in descending order of preference:

  • If the content is XHTML, write XHTML and validate it with an XHTML validator.
  • If the content is not XHTML, remove the meta tag that claims it is.
  • If the content is not XHTML but you can't remove the meta tag, say because your CMS doesn't let you, disable the convert_meta_tags filter in your pagespeed.conf:
  • Apache:

    ModPagespeedDisableFilters convert_meta_tags


    pagespeed DisableFilters convert_meta_tags;

    Article adapted from PageSpeed ~ Frequently Asked Questions.

Was this answer helpful?

« Back

Find your perfect domain

Use our domain name search to check your dream domain name

Wide Variety of Domains

Easy Registration Process

Free WHOIS Privacy