Since  weve  talked  about  creating  your  own  languages  with  XML,  perhaps  we  can extend  that  analogy.  If  the  elements  are  the  words  of  our  language,  the  schema  is the grammar. It tells the world how the words have to be arranged so that they are meaningful  to  our  applications.  You  read  earlier  about  valid  XML  documents.  A schema is used to determine that an XML document is valid for that schemas particu- lar set of rules. As with natural languages, there is a lot that can go into determining that a docu- ment is valid. Think about it in terms of plain old English documents, such as this book. On one level, this book is valid if the individual sentences are grammatically cor- rect. The editors have certain requirements about section headings before they will call it valid. The publisher wants the book to be a certain length and of a correct tone and quality before it is considered valid to ship it to the stores. Ultimately, the reader makes the call as to how valid the book is as a resource based on a number of factors. The validity tests for XML documents can be as multifaceted as this. At the lowest level, a schema can be used to determine if particular nodes have values of the right type. The next step is to determine that the structure is right. Do the children elements belong with their parent? Does the parent have all of the children nodes for it to be valid? Then, you can look at how the different elements relate to each other to make determinations of integrity. From there, the sky is the limit. If you desire, you can pile complex business rules into your schema. With an idea as to what schemas are about, its time to focus on how to implement one. This can be as confusing as the complicated schemas we are talking about! There are  several  different  ways  to  define  schemas.  These  are  called  schema  languages. (Good  thing  the  languages  we  develop  with  XML  are  called  schemas,  or  else  they would have to be called language languages!) The original schema language is DTD. In fact, it has its own instruction built in to XML: <!DOCTYPE>. Though still widely used, DTDs are becoming unpopular for a number of reasons, including cumbersome syntax and the inability to define data types. The other popular schema languages are XML based.  W3C  XML  Schema  is  the  heir  apparent.  There  are  other  players,  including RELAX NG, Schematron, and Exampletron. Moving On In the previous pages, XSQL was covered at a high level. You learned the problems that XSQL addresses and how it integrates the technologies together. The XML basics covered in the previous section will come up again and again throughout the book. Now, its time to dive into XSQL development. The next couple of chapters cover the installation and setup of XSQL. After you have XSQL installed, youll be ready to move forward. 22 Chapter 1 271209 Ch01.F  12/9/02  2:00 PM  Page 22