The short name for XML Schema is XSD(XML schema definition). An XML schema is a document or a set of documents that defines the structure and legal elements of the XML file. XML schemas can be used to ensure that an XML file is syntactically correct and conforms to the defined schema.
XML Schema have a number of advantages over DTDs.
The <schema> element is the root element of every XML Schema. The <schema> element may contain some attributes. A schema declaration often looks something like this:
...
...
indicates that the elements and data types used in the schema come from the "http://www.w3.org/2001/XMLSchema" namespace.
.....
A simple element is an XML element that can contain only text. It cannot contain any other elements or attributes.
Syntax
NOTE: minOccurs and maxOccurs specify how many occurrences of the element may appear in an XML document.The default value for minOccurs is 1 and unbounded is used to specify an upper limits in maxOccurs.
example
The complexType allows you to hold multiple elements. It can contain additional sub elements or can be left empty.
Syntax
XML Schema has a lot of built-in data types. The most common types are:
All attributes are declared as simple types. If an element has attributes, element is considered to be of a complex type.
Syntax
Attributes may have a default value. A default value is automatically assigned to the attribute when no other value is specified.
Syntax
Attributes may have a fixed value specified. A fixed value is also automatically assigned to the attribute, and you cannot specify another value.
Syntax
Attributes are optional by default. To specify that the attribute is required, use the "use" attribute:
Syntax
Ramu
501
Arun
401