1.1. X-definition and model of XML element

As a starting point, consider following XML element that describes a book:
<Book ISBN = "123456789"
      published = "2010" >
      title = "X-definition tutorial" >
</Book>
    XML data can be described, for example, using XSD (XML Schema) or Relax NG. X-definition is an alternative approach to XML data description. The X-definition allows for a more precise and detailed description of XML data. Let's get a first idea of what an XML element description looks like in an X-definition (this description is called an element model).
    X-definition describes the names and cardinality (possible number of occurrences) of items and the structure of children in the XML element model. An X-definition itself is an XML element with the X-definition namespace ("b>http://www.xdef.org/xdef/4.2") and local name "def" where the name prefix referrs to the X-definition namespace. The child nodes of an X-definition can be element models.
    Note that such a description looks similar to the data it describes, but attribute values (and textual content of elements) are replaced by value descriptions in this model. The description of data value contains the quantifier (specification of occurrence) of the value and the call to the validation method (analysis and evaluation of the data type). For example:
   required int(10000000, 999999999); mandatory integer number in range 10000000 ... 999999999
   optional gYear();                  optional notation of calendar year
   required string();                 mandatory character sequence
The language used here to describe data values is called "X-script" of the X-definition.

The element models are written as child nodes of this element. The X-definition with XML data model describing the above book will be of the form:
<xd:def xmlns:xd="http://www.xdef.org/xdef/4.2">
  <Book ISBN = "required int(10000000, 999999999); /* ISBN code - integer number in the given range */"
        published = "optional gYear(); /* year of publishing (can be omitted). */" 
        title = "required string(); /* any string */" >
  </Book>;
</xd:def>
Note the possibility to write comments (/*...*/) in the X-script.