How XML Schema Validates XML

XML Schema is a way to describe what is valid or not valid XML.

XML Schema

XML Schema is used for validation between applications. For example suppose communication between an airline company and a hotel company suddenly breaks. The XML schema is used to check on which side the mistake was made.

Picture below is a sample document and schema contract. You can see the tags between the two match up. However, if the document had a different tag name, than as specified in the contract, it would not get validated.

XML Valdation
If XML tags in the document agree with the schema, then the XML will get validated.

In essence, a schema formalizes the relationship between applications. There are many types of XML schema languages, but XSD from W3C tends to be the most common.

Look at the picture below for an example of XSD constraints. Constraints serve to lock-in the contract between applications.

XSD Contstraints

You should also be familiar with the various XSD data types.

XSD Data Types

You need to understand the date/time format, so that you will know how to sort it.

Date Format
It is best practice to not change the date format.

It is best to stick with this format when working with dates and time inside a computer.

Leave a Reply

Your email address will not be published. Required fields are marked *