1.5. Declaration of types, methods and variables

Types, methods and variables used in the Script you may declare in the auxiliary element "xd:declaration":

<xd:declaration>
  type isbn int(0, 9999999999);
  type published gYear();
  Date today = now();
  void message(String s) {
    outln(s);
  }
</xd:declaration>

<Book xd:script="init message('Started ' + today); finally message('Process finished');"
      isbn="isbn();"
      published="optional published();" > 
      <Author xd:script="occurs *" >
        <xd:text> string() </xd:text>
      </Author>
      <Title>
        <xd:text> string() </xd:text>
      </Title>
</Book>

Prev  Content   Next