1.1. Model of XML element in X-definition

As a starting point, we consider an XML element providing some data:
<Book isbn = "123456789"
      published = "2010" >
      title = "X-definition tutorial" >
</Book>
Usually, such an element may be regarded as an instance of a model, for example, written in 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, but 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 called 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:
<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>;