O'Reilly logo

Real World XML by Steven Holzner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 the schema is targeted to (that 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. For an example using the targetNamespace ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required