Control File

The core of the template file is a control file named "control.xml". It is an XML file containing information about files to be generated. It is structured as follows:

control.xml

<?xml version="1.0" standalone="yes"?>
<product>
    <control ... />
    ...
    <control ... />
</product>

 

1. <product>

The top level is the product level identified by the <product> tag. (The tag name "product" will be replaced by unique product name identifier in respective products.) It gives a brief description of the template and serves for product and version information purpose. The code generator will monitor changes in this tag before generating scripts with the template.

Syntax:

<product
    date="release_date"
    version="version_number"
    desc="description"
    language="lang_name"
    author="author_name">
...
</product>

 

Attributes Description
date Template creation date
version Template version number
desc Brief description of the template
language Language of the template
author Author of the template

 

2. <control>

The next level is the control level identified by the <control> tags. Each <control> tag specify an output file or a set of output files to be generated by the code generator.

Syntax:

<control
    id="control_id"
    type="control_type"
    ofile="output_file_name"
    oext="output_file_extension"
    tagext="class"
    ifiles="input_files"
    ofolder="output_file_folder"
    ofolderid="output_file_folder_id"
    remark="remark"
    cond="conditions"
/>

 

Attributes Description
id Control ID. This attribute identifies the page(s) to be generated.
ofile Output file name
oext Output file extension
tagext Optional. Control tag extension. It is used to distinguish control tags with the same ID. Some control tags have same ID because they are related, usually one is a class file, the other a page using the class. Possible value is "class" only. If tagext="class", the file is a class and will by generated to the output folder with id="_classes". If no tagext, the file will be generated according to the ofolder or ofolderid attribute (see below).
type

Control type. Possible values are:

folder Define folder name by an ID. The folder ID is to be used by ofolderid attribute (see below) of other controls. The control must have id and ofolder attribute (see below).
table Table-related files. An output file will be generated for EACH table. For example, the control with id="list" generates List page for each table.
other Non table-related files. These files are usually files that may be included or used by other files. For example, the config file and header/footer file.
simple Similar to other attribute, but no file prefix/infix/suffix (see Generate Settings) will be used for these files.
copy Copy file or folder from the template to the output folder directly.
system Internal control used by system. DO NOT CHANGE.
ifiles Input file(s). (Currently it is always one file for each control only.)
ofolder Optional. Output folder (relative to project folder). If no ofolder or ofolderid is specified, the default output folder is the project folder.
ofolderid Optional. Output folder id. The id is used to get the output folder defined by controls with type="folder" (see above). If no ofolder or ofolderid is specified, the default output folder is the project folder.
remark Remark to be shown in the generation file list before generation.
cond

Condition for the control. If condition specified, the file(s) will only be generated if the condition is met. If no condition, the file(s) will always be generated.

The syntax of condition is similar to JavaScript expression:

<condition> [[<logical operator> <condition2>] ...]

Condition syntax:

<object>.<property> <comparison operator> <value>

See Object Properties for available objects and properties.

Note If the object property is not of boolean type, the comparison operator and the value MUST be provided. The property will NOT be evaluated as a boolean.

Supported logical operator:

&& AND
|| OR
! NOT

Note Parentheses are supported.

Supported comparison operators:

== equal
!= not equal
> greater than
>= greater than or equal to
< less than
<= less than or equal to

Value:
value for comparison

 

 

 ©2002-2021 e.World Technology Ltd. All rights reserved.