Skip to content

crawl/sitemap-valid: a sitemap with a namespace-prefixed root (ns0:urlset) is reported as Unknown sitemap format #759

Closed

Description

@nc9

parseSitemap (packages/crawler/src/sitemaps.ts) looks for a root element named exactly urlset or sitemapindex. A sitemap that binds the sitemap namespace to a prefix, such as <ns0:urlset xmlns:ns0="http://www.sitemaps.org/schemas/sitemap/0.9"><ns0:url><ns0:loc>..., is reported by crawl/sitemap-valid as Unknown sitemap format, and none of its URLs are read. Python's ElementTree writes this form by default when a namespace is registered without an empty prefix, and it is valid XML in the sitemap namespace. The body check in decodeSitemapBody already accepts any prefix on the root, so the file is treated as a sitemap and then fails to parse as one.

Found while reviewing #687 (PR #757).

Acceptance Criteria

  • A urlset whose elements carry a prefix bound to http://www.sitemaps.org/schemas/sitemap/0.9 parses with no errors, and its URLs, lastmods and priorities are read as for the unprefixed form.
  • The same holds for a prefixed sitemap index and its child sitemaps.
  • A root in another namespace, whatever its prefix, is still Unknown sitemap format.
  • Parser tests cover the prefixed urlset, the prefixed index and the foreign-namespace root.

Activity

  1. added
    bug
    P3
    size: S
    on Oct 14, 2026
  2. nc9 commented on Oct 15, 2026

    @nc9
    ContributorAuthor

    Note from the review of #792: criterion 3 ("a root in another namespace, whatever its prefix, is still Unknown sitemap format") is implemented for PREFIXED roots only. An unprefixed root with a wrong or missing default namespace (<urlset xmlns="urn:other">, or no xmlns at all) is still read as a sitemap, as before. Many real sitemaps declare a wrong or missing namespace, so tightening that would drop them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3bugsize: S

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions