Sitemap validator W3C: separate URL preflight from schema validation

An HTML checker reports success, yet the sitemap contains no usable absolute page URL. Identify whether you have HTML navigation or an XML urlset, then keep parsing, schema and protocol checks separate.

The example prepares escaped XML and a separate absolute-URL preflight. For https://example.org/notes?a=1&b=2, the loc source contains & while the intended parsed URL retains an ordinary ampersand. A relative value notes/chapter-one fails the local absolute-HTTP(S) check. The page does not call that preflight a W3C schema result or claim to run an XML validator.

Which layer did you actually check?
Which layer did you actually check?
Open the full example ↗

Choose the correct input and schema

This task covers a base XML urlset with namespace http://www.sitemaps.org/schemas/sitemap/0.9. An HTML navigation page and a sitemap index are different inputs; indexes have a separate schema. Keep the candidate source and the actual selected XSD with the native test record. The official Sitemaps protocol links both formats. A search phrase containing W3C is not a reason to validate XML as HTML or assume an old tool listing supplies a current installed validator.

The original one-URL fixture contains a url element with loc as its required child. Escape text data when generating the source. The example's bounded composer takes an intended URL, escapes ampersands and angle brackets, and displays the resulting urlset. It also lets you inspect the no-loc and unrelated-namespace cases as test preparations. Those controls construct source text; they do not establish that the generated candidate parsed or matched a schema in a native environment.

Retain three different outcomes

For native XML parsing, retain exact source bytes, parser/tool version, command, exit status and diagnostics. Raw unescaped ampersands in query text should fail XML parsing; there is no schema acceptance to report for malformed input. Missing loc or wrong namespace can be well-formed XML yet fail the selected urlset schema. Keep expected outcomes and actual validator observations in different columns. A blank stdout produced by a no-output option is not enough to decide a pass without the actual exit result and diagnostics.

For the schema layer, pin the official sitemap.xsd bytes and hash used in the test. A documented local command shape is xmllint --noout --schema local-sitemap.xsd candidate.xml after confirming installed support. Do not let a changed remote schema silently replace the artifact associated with a historical result. Keep candidate hash, schema hash, options and tool version together. This article supplies test cases and workflow instructions rather than a fabricated native command transcript.

Keep protocol requirements outside the XSD result

The relative string notes/chapter-one is 17 characters. The inspected base schema's anyURI length rules motivate an expected schema acceptance, but that remains an expectation until a native run. The separate protocol requirement for an absolute URL still fails. Likewise, an unbounded XSD occurrence does not enforce the protocol's 50,000-URL limit. Record URL count, byte size, host and sitemap-location scope independently; a schema result cannot establish reachability, robots behavior, accurate dates or search indexing.

Use a layer-specific conclusion at handoff: local URL preflight accepted, XML parse observed, XSD observed, or operational checks pending, as appropriate to actual evidence. The composer clears old feedback when values change and never fetches the page URL. Keep native XML, pinned schema and diagnostics authoritative. Fix the failing layer, rerun the affected checks, and preserve earlier results under their original candidate and tool revisions instead of presenting one all-purpose valid badge.

Make your own working example

Build an original XML sitemap preparation helper, explicitly not a native W3C or XSD validator. Provide intended loc input default https://example.org/notes?a=1&b=2, namespace input default http://www.sitemaps.org/schemas/sitemap/0.9, Compose/preflight, Relative case, Missing loc, Wrong namespace and Reset buttons.

Generate a single-url XML urlset with escaped text and show the intended parsed loc separately. Check local presence, declared namespace and absolute HTTP(S) URL using actual URL parsing without fetching. Relative notes/chapter-one must fail the URL preflight; a missing loc and wrong namespace produce clear preparation issues. Always label XML parse and XSD validation not executed. Do not claim regex or URL checks are schema validation.

Show a concise native checklist with candidate/schema hashes, installed xmllint version, separate parsing and --noout --schema command, exit/diagnostics, and separate protocol count/size/host/location checks. Explain raw ampersand versus escaped source and expected schema/protocol disagreement for the 17-character relative case. Edits invalidate prior preflight. No crawler submission, network probing, indexing guarantee or fake native pass.

Use one self-contained HTML file with no remote dependency. Keep the initial sample, output, and labeled controls near the top. Use at least 16px text, strong contrast, visible focus, and a stacked layout at 360px without horizontal overflow. Use explicit type=button click handlers and explicit DOM selectors; do not depend on native form submission. Clear stale feedback when task inputs change. Render entered text safely. Keep practice data local to the current page; do not imply saving, sending, or production integration. Return only the finished HTML.

Explain the failing layer

Preserve candidate XML, schema bytes and native diagnostics with the validation record. In NOS, eligible static notes on an HTML comparison can be revised visually without asking AI to regenerate the page. Clarify whether the reviewer found a URL, parsing or schema issue before the next native check.

Keep reading