The Schema Namespaces
All standard schema elements are in the http://www.w3.org/2001/XMLSchema
namespace.
In this chapter, we assume that this URI is mapped to the xs
prefix using an appropriate xmlns:xs
declaration. This declaration is
almost always placed on the root element start-tag:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
In addition, several attributes are used in instance documents to associate schema information with
them, including schemaLocation
and
type
. These attributes are in the
http://www.w3.org/2001/XMLSchema-instance
namespace. In this chapter, we assume that this URI is mapped to the
xsi
prefix with an appropriate
xmlns:xsi
declaration on either the
element where this attribute appears or one of its ancestors.
In a few cases, schema elements may contain elements from other
arbitrary namespaces or no namespace at all. This occurs primarily
inside xs:appinfo
and xs:documentation
elements, which provide supplementary information about
the schema itself, the documents the schema describes to systems that
are not schema validators, or to people reading the schema.
Finally, most schema elements can have arbitrary attributes from
other namespaces. For instance, this allows you to make an xs:attribute
element a simple XLink by
giving it xlink:type
and xlink:href
attributes or to identify the
language of an xs:notation
using an
xml:lang
attribute. However, this
capability is not used much in practice.
Get XML in a Nutshell, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.