Hello,
We apologize for the issue you are facing with your sitemap XML validation. The error you mentioned indicates that there is an invalid XML syntax due to having two XML declarations on the same line. This can happen if there is a stylesheet reference included incorrectly.
To resolve this issue, please follow these steps:
- Check Your Sitemap Source: Open your sitemap in a browser and view the page source. Look for any lines that contain `
Sources:
How to Fix Whitespace Errors Breaking Your XML Sitemap in WordPress » Rank Math
Rank Math Sitemap Issues and Their Fixes » Rank Math
This is an automated reply from Rank Math Support Bot. Your ticket has been assigned to a human agent and we will get back to you shortly.
Hello,
Thank you for reaching out to us.
We tested your sitemap in the validator – https://www.xml-sitemaps.com/validate-xml-sitemap.html, and no issues were detected:

Please follow the steps below for initial troubleshooting:
1. Flush the Sitemap cache by following this video screencast:
https://i.rankmath.com/pipRDp
2. Exclude the Sitemap files of the Rank Math plugin in your caching plugin. The cache could be via a plugin or from the server. For plugins or Cloudflare, please follow this article: https://rankmath.com/kb/exclude-sitemaps-from-caching/
If the issue persists then try disabling the transient cache for the sitemap. This will make sure that your XML sitemap always reflects the latest changes on your site. Kindly add this code snippet to your site:
/**
* Filter if XML sitemap transient cache is enabled.
*
* @param boolean $unsigned Enable cache or not, defaults to true
*/
add_filter( 'rank_math/sitemap/enable_caching', '__return_false');
If you’re not sure how to add this code, you can follow this guide: https://rankmath.com/kb/wordpress-hooks-actions-filters/.
After you add the code, please clear any cache on your site or server and check your XML sitemap again. If you’re still facing issues with the sitemap, please let us know – we are happy to investigate further.
Hello
Try the validator I shared which validates the XML code itself not the xml sitemap.
The issue is about XML code as previously mentioned.
It is being detected by almost all SEO tools.
Waiting for your response.
Hello,
We checked your sitemap with this tool, but we were not able to find any errors there. Here’s a screencast for your reference: https://i.rankmath.com/v/JhbQfl
If you’re still facing the issue, please share a screencast with us using a tool like https://loom.com so that we can check the issue further for you.
Looking forward to helping you.
Thank you.