When XML first came out, there were DTDs (Document Type Definitions) that defined what the XML was going to look like and how it worked. But DTDs were written in yet another format than XML and so if you wanted to write XML applications you had to learn XML and how to write a DTD. But then along came the XML Schema language, a language written with XML. With this language, you don't have to learn a second format to define how your XML applications will work.
You can use XML to define just about any kind of text data that you might want to. For example, I might want to define a schema for the newsletter information that I send out in the Web Design / HTML newsletter.
The purpose of a schema is to define your XML document. So, the easiest way to create a schema is to start with a basic XML document that you want to define. Here's the XML I wrote for the newsletter. Andhere's the related Schema.
This document consists of a main element:
and five sub elements:
Each of the sub elements contains more elements, and so on down to elements like section1_linktitle1 that contain only text (or numbers or dates) with no XML elements. An element that contains a sub element is called a complex type, while elements that only contain text, numbers, or dates are called simple types. When you write your schema, you'll define the complex types and some of the simple types in your XML document.