Easy Tutorial
❮ Schema Complex El All ❯

Why Use XML Schemas?


XML Schema is more powerful than DTD.


XML Schema Supports Data Types

One of the most important capabilities of XML Schema is its support for data types.

Through support for data types:


XML Schema Uses XML Syntax

Another important feature of XML Schema is that they are written in XML.

Writing XML Schema in XML has many benefits:


XML Schema Protects Data Communication

When data is sent from a sender to a receiver, the key point is that both parties should have the same "expectation" about the content.

With XML Schema, the sender can describe the data in a way that the receiver can understand.

A piece of data, such as "03-11-2004," is interpreted as November 3 in some countries and as March 11 in others.

However, an XML element with a data type, such as <date type="date">2004-03-11</date>, ensures consistent understanding of the content because the XML data type "date" requires the format "YYYY-MM-DD."


XML Schema is Extensible

XML Schema is extensible because they are written in XML.

With extensible Schema definitions, you can:


Well-Formedness is Not Enough

We call a document that conforms to XML syntax a well-formed XML document, such as:

Even if a document is well-formed, it still cannot guarantee that it does not contain errors, and these errors can have serious consequences.

Consider the following scenario: You ordered 5 dozen laser printers instead of 5 units. With XML Schema, most such errors would be caught by your validation software.

❮ Schema Complex El All ❯