Schemas and Namespaces
One of the big ideas behind schemas was to allow XML processors to validate documents that use namespaces (which DTDs have a problem with). Toward that end, the <schema> element has a new attribute: targetNamespace.
The targetNamespace attribute specifies the namespace to which the schema is targeted—that is, the namespace that it is intended for. This means that if an XML processor is validating a document and is checking elements in a particular namespace, it will know what schema to check, based on the schema's target namespace. That's the idea behind target namespaces: You can indicate what namespace a schema is targeted to so that an XML processor can determine which schema(s) to use to validate a document.
You can ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access