Schemas and validity
Schema location
An attribute in an instance document pairing a namespace URI with a URL where a schema for it may be found — a hint, not an instruction.
xsi:schemaLocation takes pairs: namespace, then location, whitespace-separated. Its unnamespaced sibling, xsi:noNamespaceSchemaLocation, takes a location alone. Both live in the XMLSchema-instance namespace and both are advisory.
A validator is entirely free to ignore them, and most do — fetching a schema named by the document being validated is the same remote-fetch risk as an external entity. In practice you supply the schema yourself, which is also the only way to know which version was used.
- Defined in
- XSD 1.0 §2.6.3
- Category
- Schemas and validity
- Also written
- xsi:schemaLocation, xsi:noNamespaceSchemaLocation
Shown, not asserted
This claim is executed on every test run, against the same engines the tools use. If the behaviour changes, the test fails rather than this page quietly becoming wrong.
A schemaLocation pointing nowhere costs nothing: nothing fetches it.
document.xml <x xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://example.invalid/nope.xsd">hi</x>What the engine returns
Well-formed.
What catches people out
- The paired form needs both halves. A namespace with no location, or a location with no namespace, is silently useless.
- Do not treat a schemaLocation as provenance. Anyone can write any URL there.
- Using the noNamespace form on a namespaced document is a common mix-up, and produces a validator that finds no declarations at all.
Where it bites
A definition on its own is trivia. These are the pages where this term decides whether a document works.
- NamespacesXML Schema instanceThe namespace both attributes live in.
- Schema errorsNo matching global declaration for the validation rootWhat you see when the wrong schema, or none, was applied.
- ToolsXSD validatorTakes the schema explicitly, which is the reliable way to do this.
Related terms
- Target namespaceThe namespace a schema's declarations belong to, named by the targetNamespace attribute on xs:schema.
- XML Schema (XSD)The W3C schema language: a grammar written in XML itself, with datatypes, namespaces and a type system.
- ValidA well-formed document that also conforms to a declared grammar — a DTD, an XSD schema or a RELAX NG grammar.
- External entityAn entity whose replacement text lives outside the document, named by a SYSTEM or PUBLIC identifier and fetched when the entity is referenced.
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.