1.1. Model of XML element in X-definition

As a starting point, consider an XML element that describes a book:
<Book ISBN = "123456789"
      published = "2010" >
      title = "X-definition tutorial" >
</Book>
Usually, XML data can be described using a model written, for example, in the XSD or Relax NG schema. X-definition is an alternative and, as it turns out, a very different approach to modeling XML data. A key difference lies in the comprehensiveness of the model, which does far more than specify data structure and data types. Let us come closer and get a first impression of what an X-definition model looks like.

In X-definition, the model of an XML element describes, among other things, the structure of that element: the names and cardinalities of items, their order, and their parent-child relationships. The first thing to notice is that the model looks very similar to the data elements which it describes. However, instance data - attribute values and element text content - have been replaced by model data describing the attribute or text nodes of the element in question. Note that the datatype specification consists of a validation method (parsing and evaluating the instance data). For example:
   int(10000000, 999999999)
   gYear()
   string()

Note the cardinality constraints (quantifier - optional, required, and others) preceding the validation method. Note also the use of comments (/*...*/) within the model description.

The language used for a description of data values we call the "X-script" of X-definition. The XML element model with the book will be of the form:
<Book ISBN = "required int(10000000, 999999999); /* ISBN code must be an integer number in the range */"
      published = "optional gYear(); /* year of publishing is not required. */" 
      title = "required string(); /* any string */" >
</Book>;