Sitemap index
<loc>
The URL of a child sitemap. Same element name as in a sitemap, different meaning: it points at a file, not at a page.
The rules are the URL rules — absolute, escaped, at most 2,048 characters — and the meaning is what changes. A <loc> in an index names a sitemap to fetch; a crawler that follows it and finds a page rather than a sitemap simply drops the entry.
Because the element name is identical, an XPath expression written for one document type silently matches the other. This is where local-name() and a root element check earn their keep.
- Format
- Sitemap index
- Namespace
- Sitemap protocol 0.9
- Parent
- <sitemap>
- How many
- Exactly one per <sitemap>.
What our validator does
Extracted for each child entry; a missing one is an error. Duplicate child URLs are deduplicated when the index is expanded rather than reported.
Broken and fixed
Both documents below are well-formed XML — that is the point of this corpus — and both are run through the validator on every test run. The verdicts here are what it returned, not what we expect it to.
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc></loc>
<lastmod>2026-08-10</lastmod>
</sitemap>
</sitemapindex>1 child sitemap(s) are missing a <loc>.<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://example.com/sitemap-1.xml</loc>
<lastmod>2026-08-10</lastmod>
</sitemap>
</sitemapindex>Where it reaches
- XPathlocal-name()How to write a path that tells an index <loc> from a sitemap <loc>.
- Datatypesxs:anyURIThe XSD type the schema declares for the value.
- ToolsSitemap validatorFollows the index and checks the children it names.
Related elements
- <sitemap>One child sitemap in an index: a required <loc> pointing at the sitemap file, and an optional <lastmod> for it.
- <loc>The URL itself — the only required child of <url>, and the element where ampersands in query strings go wrong.
- <lastmod>When a child sitemap last changed — the element that lets a crawler skip a file it has already seen.
Get started
Bring order to the XML your team can't afford to ignore.
Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.