XML Schema - An XML schema describes the structure of an XML document.
XML schema language also referred as XML schema definition(XSD).
XSD is XML based alternative of DTD(Data Type Definition).
Basics
1. Defines elements of document.
2. Defines attributes of document.
3. Defines which elements are child elements.
4. Defines no. of child elements and order of child elements.
5. Defines an element is empty or can have text.
6. Defines data types for elements and attributes.
7. Defines Default and fixed values for elements and attributes.
8. W3C recommendation.
XSDs are successor of DTDs because
1. XSDs are richer, more powerful and extensible in future.
2. Written in XML.
3. Support data types.
4. Support namespaces.
Why XSDs are recommended
1. XML format - Platform independent.
2. Extensible - Own data types can be created based on standard data types, other schemas can be referenced in a schema, a document can have references of multiple schemas.
3. Support data types - Can be define allowable contents, makes data type conversion easy.
4. Secure data communication - Both ends having data structure.
Example
Simple XML document
<?xml version="1.0"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
XML schema language also referred as XML schema definition(XSD).
XSD is XML based alternative of DTD(Data Type Definition).
Basics
1. Defines elements of document.
2. Defines attributes of document.
3. Defines which elements are child elements.
4. Defines no. of child elements and order of child elements.
5. Defines an element is empty or can have text.
6. Defines data types for elements and attributes.
7. Defines Default and fixed values for elements and attributes.
8. W3C recommendation.
XSDs are successor of DTDs because
1. XSDs are richer, more powerful and extensible in future.
2. Written in XML.
3. Support data types.
4. Support namespaces.
Why XSDs are recommended
1. XML format - Platform independent.
2. Extensible - Own data types can be created based on standard data types, other schemas can be referenced in a schema, a document can have references of multiple schemas.
3. Support data types - Can be define allowable contents, makes data type conversion easy.
4. Secure data communication - Both ends having data structure.
Example
Simple XML document
<?xml version="1.0"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>

