You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
crawl/sitemap-valid passes a sitemap with mismatched or unclosed tags: the parser never checks well-formedness #760
fast-xml-parser, which parseSitemap (packages/crawler/src/sitemaps.ts) uses, does not check that the XML is well formed. A mismatched closing tag (<loc>https://example.com/a</loc></lox>) or an element left open parses without an error, so crawl/sitemap-valid reports Sitemap XML syntax is valid for a file that a strict consumer would reject. XMLValidator.validate from the same package reports these, and a raw &.
Found while reviewing #687 (PR #757), which makes a raw < inside a field count as an error, but only where the parser happens to read it as a child element.
Acceptance Criteria
A sitemap with a mismatched closing tag, an unclosed element, or a raw & in a <loc> gets a crawl/sitemap-valid syntax error naming the problem, and the URLs the parser can still read are still read.
Well-formed sitemaps, including ones with CDATA, comments, xhtml:link and image:image extensions, get no new error.
The well-formedness check stays linear in the body size on a 50 MB sitemap (time it at n, 2n, 4n).
Fixed in #892. Once a sitemap root parses, parseSitemap runs XMLValidator. It records XML is not well formed: <reason> (line L, column C) for a mismatched closing tag, an unclosed element or a raw & in element text, and keeps the URLs it can read. These get no new error: well-formed files with CDATA, comments, xhtml:link/image:image, escapes, a BOM or leading whitespace. Files with an internal DTD subset are not checked. Validation timed at 168/326/672 ms for 12.5/25/50 MB, and a test pins the linear ratio. The tests are in packages/crawler/tests/sitemap-well-formed-760.test.ts.
Activity
fix(sitemaps): report sitemaps that are not well-formed XML and lastm…
fix(sitemaps): report sitemaps that are not well-formed XML and lastm…
nc9 commentedon Oct 16, 2026
Fixed in #892. Once a sitemap root parses,
parseSitemaprunsXMLValidator. It recordsXML is not well formed: <reason> (line L, column C)for a mismatched closing tag, an unclosed element or a raw&in element text, and keeps the URLs it can read. These get no new error: well-formed files with CDATA, comments,xhtml:link/image:image, escapes, a BOM or leading whitespace. Files with an internal DTD subset are not checked. Validation timed at 168/326/672 ms for 12.5/25/50 MB, and a test pins the linear ratio. The tests are inpackages/crawler/tests/sitemap-well-formed-760.test.ts.