xml schema tutorial

what is an schema ?

an xml schema is a language for expressing constraints about xml documents.it used to create xml-based language and data models.

technically, a schema is an abstract collection of metadata, consisting of a set of schema components:chiefly element and attribute declarations and complex and simple type definitions.xml schema documents usually have the filename extension ".xsd".a unique internet media type is not yet registered for xsds, so "application/xml" or "text/xml" should be used.

a schema can be used:

  • to provide a list of elements and attributes in a vocabulary
  • to defines data types for elements and attributes
  • to defines the parent-child relationship
  • to provide documentation that is both human-readable and machine-prcessable
  • to defines default and fixed values for elements and attributes

the power of xml schema

xml schemas are richer and much more powerful then dtds.some important points understanding the power of xml schema.

  • xml schema support data types but dtd do not support user-derived datatypes.
  • xml schema support namespaces but dtd do not support.
  • xml schema enable you to more easily create complex and reusable content models.
  • xml schema enable the modeling of programming concepts such as object inheritance    and type substitution.