Previous Next

An XML schema definition (XSD) is a document that describes the valid format of an XML document, in terms of the allowed XML elements and attributes, the number of occurrences of XML elements, and more. XSD makes it easier to validate documents based on namespaces.

A namespace is a collection of names that are used in XML documents as element types and attribute names. A namespace is uniquely identified by a URI reference (Uniform Resource Indicator).

Since the element and attribute names in an XML document may also occur in an XML document from another source, there must be a way to differentiate between the elements that come from the different sources. This is what namespaces secure.

Names from XML namespaces may appear as qualified names. This is a name containing a single colon, separating the name into a namespace prefix and a local part. The prefix or alias, which is mapped to the URI reference, selects a namespace. The combination of the universally managed URI namespace and the document's own namespace produces identifiers that are universally unique.

In an XML schema document, the line

xmlns:xsd = ""

specifies that all XML schema elements are to be prefixed with an xsd: element. For example:


Since a web service uses XML based messages to exchange data with a client application, and this application needs to know the structure of the exchanged data, the web service provider has to supply one or more XML schema definitions for this data.

See Also

How to Define a Namespace for an XML Schema