HowTo: Fix XML Parsing Error: not well-formed Sitemap.xml



It really helps when you do routine maintenance checkups on your blog or website. While performing a checkup on JaypeeOnline earlier today, I was surprised to find out that the sitemap wasn’t working. Whenever I tried to access it, I would get this error message: XML Parsing Error: not well-formed (see screenshot below).

xml parsing error

Since I was using the Yoast SEO plugin (formerly WordPress SEO) to generate my sitemap, I checked the configuration/settings to see if there was something wrong there but everything checked out fine. So the next thing I did was to try to disable-enable the XML sitemap functionality to allow the plugin to rebuild the sitemap and see if that can fix the problem. It didn’t.

I logged in to the WordPress support forums to see if anyone had a solution for the XML Parsing Error. I found out that this was a bit common especially for users who were using both the Yoast SEO plugin and the W3 Total Cache plugin. I tried disabling the Minify Javascripts option on W3 Total Cache and the sitemap worked! It verified what other users mentioned about it being an issue caused by a conflict between those two plugins.

Several posts suggested adding some lines of code to the .htacces file. I tried them and the XML Parsing Error disappeared but now I was getting an ERROR 404 or Page not found error. I went to the Yoast Knowledge Base to see if they had a solution to this problem. The documentation suggested adding the following code into the .htaccess file.

So I edited my .htaccess file and added the code, emptied all caches. I tried to access the sitemap and I still got a 404.

After spending a few more minutes looking for a solution, I finally found one that worked. So if you’re getting the XML Parsing Error: not well-formed error message when trying to access your sitemap, try this:

  • Login to your WordPress dashboard.
  • Go to the Minify section of W3 Total Cache – Performance > Minify
  • Scroll down into the Advance section.
  • Look for “Never minify the following pages:
  • Copy & paste the following lines of code inside the box.
  • Click on Save all settings.
  • Empty all caches.

That’s it! Your sitemap should be up and running. This is what I did to fix the XML Parsing Error: not well-formed issue that I had with my sitemap. Hope this tutorial was able to help you.

Anyone else experienced getting the XML Parsing Error when trying to access your sitemap? Were you using both the Yoast SEO and W3 Total Cache plugins? Please share your thoughts by leaving a comment below.

Owner and editor of JaypeeOnline. Self-proclaimed geek. New media writer and consultant. WordPress advocate. Loves blogging, gadgets, video games and sports. You can follow him on Google+, Facebook or Twitter.

10 Comments

  1. Joe garden

    January 5, 2019 at 8:19 PM

    Not using WordPress for my site. Entire site is built with html. Have Sitemap.xml submitted to google but having parsing error in sitemap by google. How do I fix it?

  2. Rohit Roy

    August 29, 2016 at 1:49 PM

    Awesome this code is work like charm…. Thanks man for sharing.

  3. Richard

    July 27, 2016 at 7:54 AM

    Thank you for taking the time to post this – we had this error on the site I manage but it looks like following your advice has cleared it up. You’ve been a real help to me!

    • JP Habaradas

      July 27, 2016 at 3:34 PM

      You’re most welcome! Glad to be of help. This is why we share these types of posts/tutorials, so we can help users like you.

  4. SteveFGI

    April 25, 2016 at 4:17 PM

    100% fix to my problem with sitemap in Yoast. I tried switching off various plug-ins because i suspected plug-in interaction was the source of the problem. Fortunately I didn’t waste too much time before I found your solution. Thanks a lot.

    • JP Habaradas

      July 27, 2016 at 3:33 PM

      You’re welcome! Glad to hear that this tutorial was able to help you.

  5. crystal

    January 12, 2016 at 5:17 AM

    Awesome thank you!!

  6. ebizguy

    October 14, 2015 at 9:59 AM

    Thanks for this detailed post, but didn’t work for me. I disabled minify all together and got my sitemap back. I have previously installed heaps of plugins just to remove the “Render-blocking” java scripts. Probably conflict among plugins caused the sitemap problem….thanks for the post again

    • JP Habaradas

      January 12, 2016 at 3:02 PM

      You’re welcome! The more plugins used, the more complicated things become and more difficult to figure out or pinpoint the cause.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.