1.3. Xscript of elements and text nodes

    Now we will show how to specify child nodes of an element and how to write the Xscript of XML element models. The Xscript of an XML element model must be written in the special attribute "xd:script" (the prefix "xd" must match the namespace of the Xdefinition).
    In the example below, we have added child elements "Title" and "Author". Both child elements contain a mandatory text node. The Xscript of the XML text node is written as the value of the text node (similar to attributes). Consider that there are books with one author, multiple authors or even no author. Therefore, the quantifier of the "Author" element is specified as "occurs *" (i.e., no or multiple occurrences). However, the child element "Title" must be just one (i.e., it is mandatory):

<Book ISBN="required int(10000000, 999999999);"
      published="optional gYear();" > 
  <Author xd:script="occurs *;" >
    required string(); /* name of author */"
  </Author>
  <Title xd:script="required;" >
    required string(); /* title of the book */"
  </Title>
</Book>

Since the default value of the quantifier is "required", note that the specification of this quantifier can be omitted:

<Book ISBN="int(0, 9999999999);"
      published="optional gYear();" >
  <Author xd:script="occurs *;" > string(); </Author>
    string();
  </Author>
  <Title
    string();
  </Title>
</Book>