Category: SEO and Google Search

Google Search Console: sitemap.xml rejected as invalid XML

Read this guide in Polish

The /sitemap.xml file opens in the browser, but the report shows a format error or parsing. The map may contain incorrect tags, bad namespace or unencapsulated special characters.

How to determine the source of the error

Check the server response and raw XML, not just the appearance of the document in the browser.

Validate URLSet, namespace, UTF-8 encoding, and & in URLs.

What to do step by step

1. Generate a correct urlset and loc structure in accordance with the sitemap protocol and remove items not supported by parser.

2 . Instead of manually paste XML fragments, use a serializer that correctly escapates characters.

How to check the score

The validator accepts XML and redownloading the map in Search Console does not report format error.

What to do

Do not enter raw query parameters from & without escapating in XML.