Skip to main content
XMLDir

Search 309 pages — tools, formats, elements, namespaces, directory, comparisons, XPath, datatypes, glossary, parse errors, schema errors, use cases, blog and product.

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.

What it contains

Nothing — this element holds a value rather than other elements. Its content is text, and the constraints below are what that text has to be.

Cardinality and constraints

Exactly one per <sitemap>.

  • Absolute URL, entity-escaped, at most 2,048 characters.
  • Must point at a sitemap or sitemap file, never at an HTML page or another index.
  • Same host as the index, or crawlers will not trust it.

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.

broken
<?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>.
fixed
<?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>
No errors. Warnings may remain — a conforming feed can still be missing a self link — but nothing here is wrong.

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.