XML Schema

tutorial and example
tutorial and example

XML Scheme commonly known as XML Schema Definition. It is used to describe the elements and attribute for a class of XML document. They can also specifies the structure of an XML document. It is similar to a database schema that describes the data in a database.

Syntax

Example of schema file.

student.xsd

Now see the xml file using XSD file

student.xml

Types of Scheme

There are two types of XML Scheme

Simple Type use only text based elements. It has some pre-defined simple types are:

Example

Complex type

It is used to hold multiple attributes and elements. It contains additional sub elements and can be left empty.

Example