XML Schema defines a language for describing the structure and semantics of an XML document. The three-part specification was presented in March 2001 by the World Wide Web Consortium (W3C) as a recommendation - the individual parts are available under the link below.
XML schemas use XML documentsXML schemas, in contrast to Document Type Definition (DTD), are themselves based on XML documents, which makes their creation and processing much easier. In particular, the limitations of DTDs in dealing not only with text documents but with data formats for structured data of any kind, led to the definition of XML Schema. This is, among other things, a requirement that is realized in particular as soon as B2B or B2Ccommunication or, in general, the communication of application systems is involved. Like a DTD, an XML schema determines both the vocabulary and the grammar of an XML document; however, since it is an XML document, its well-formedness and validity can be checked at any time.
Before the final specification of the XML schema by the W3C, the IT industry had already made its own efforts to use XML beyond classical document processing in the form of specific variants such as XML-Data by Microsoft or Schema for Object Or iented XML (SOX) by VeoSystems. An alternative schema language is Relax NG
The recommendation published by the W3C defines three different parts of the specification:
- XML Schema Part 0 (Primer) provides an introduction and summarizes basic information.
- XML Schema Part 1 (Structures) defines the basic structures of an XML Schema document and details all the important elements of the schema language.
- XML Schema Part 2 (Datatypes) defines the data types for schema documents.
- Be an XML document,
- be more expressive than a DTD,
- be self-documenting and readable,
- be web-enabled,
- be compatible with other XML specifications
- support automatic parsing by XML parsers, and
- take namespaces into account.
XML Schema as ApplicationAn XML Schema defines a set of components to describe the structure of a class of XML documents. Therefore, a document corresponding to the XML Schema is also called an instance of the document class fixed by the schema. The vocabulary of the XML Schema language is itself an XML application - in this case an abstract description of content structures. XML Schema itself provides 44 predefined simple data types and additionally supports mechanisms for defining user-defined simple data types. Declarations have the task of assigning a name and a corresponding data type - there are complex and simple data types - to elements or attributes. Unlike DTDs, the assignment of data types to elements and attributes is a significant aspect of XML Schema.
An XML schema can be created for a class of XML documents in different so-called modeling variants. The corresponding XML documents will then be valid to all modeling variants, distinguishing between the Russian Matryoshka, Salami Design, and Blind Design variants.
As with all XML documents, DTDs and XML schemas can be created and edited with a simple text editor. However, since this is not very convenient and time-consuming, there are a number of tools, such as XML Authority or XML Spy, which also offer a graphical representation of the DTD or XML schema structures as well as interactive modification of them. In addition, of course, the correctness of the syntax is continuously checked. It should generally be taken into account that the code of an XML schema is significantly more extensive than the code of a DTD.