error on line 2 at column 6: XML declaration allowed only at the start of the do

#617505
  • Resolved Anonymous
    Rank Math free

    Subject: XML Declaration Issue

    Hello RankMath Support Team,

    I hope you’re doing well. I’m writing to seek your assistance with a problem I’m facing on my blog website, https://www.marathispeaks.in.

    When I visit my site sitemap, I’m seeing an error message that says:

    “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.”

    I think this error has to do with the way the XML is set up on my site. I’ve checked, but I can’t figure out exactly what’s causing it. I suspect it might be connected to the RankMath plugin, which handles the SEO stuff on my site.

    Could you please help me fix this XML declaration issue? My website’s not working properly due to this, and I really want to get it back on track for my readers.

    If you need more information from me, just let me know. Your help in getting this sorted out would mean a lot to me. Thanks for your time and support.

    Best regards,
    Abhishek Kshirsagar

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math support and we apologize for any trouble you are facing with your sitemap.

    The issue you are seeing is caused by an XML declaration error on your sitemap. This means that there is some extra content or whitespace before the XML declaration in your sitemap file. This can make your sitemap invalid and unreadable by search engines.

    The most common reason for this error is a whitespace in your theme code, such as a blank line or space in your wp-config.php file or your theme’s functions.php file. This can happen when you edit these files manually or use a plugin or theme that modifies them.

    To fix this error, you need to find and remove the whitespace from your theme code. You can follow this guide to troubleshoot and resolve this issue: https://rankmath.com/kb/fix-sitemap-issues/#xml-text-declaration

    If you are not comfortable editing your theme code, you can also contact your hosting provider and ask them to check your website files for you. They should be able to locate and remove the whitespace for you.

    Alternatively, if you have some technical skills, you can also use this script to automatically fix this error: https://wejn.org/stuff/wejnswpwhitespacefix.php.html

    Please let us know if this helps you fix the XML declaration error on your sitemap. If you have any questions or issues, please don’t hesitate to contact us again. We are always here to assist you.

    Thank you for choosing Rank Math for your SEO needs.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘error on line 2 at column 6: XML declaration allowed only at the start of the do’ is closed to new replies.