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.

XML sitemap

<url>

One entry in a sitemap: a required <loc> plus the optional metadata a crawler may or may not use.

Every <url> is a parent container, never a value. Its only required child is <loc>; <lastmod>, <changefreq> and <priority> are all optional, and extension elements for images, news and video go inside it too.

The children have a defined order in the schema, but in practice crawlers are tolerant of it. What they are not tolerant of is a <url> with no <loc>, which is an entry that names nothing.

Cardinality and constraints

One or more per <urlset>, up to 50,000.

  • Exactly one <loc> is required; everything else is optional.
  • A <url> carries no attributes of its own.
  • All URLs in one sitemap should share a host — a crawler will not trust entries outside the sitemap's own directory.

What our validator does

Each <url> is checked for a <loc>, and the count of entries missing one is reported as an error.

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"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <lastmod>2026-08-10</lastmod>
  </url>
</urlset>
1 URL entr(ies) are missing a <loc>.
fixed
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/</loc>
    <lastmod>2026-08-10</lastmod>
  </url>
</urlset>
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.