Including other XML files

To avoid large gui descriptions, gui4j supports a mechanism to include other xml files. For each inclusion, an alias must be defined which is the prefix for all identifiers defined in the included file. Hence, gui4j builds hierarchical names when including other files.

Content of file basic.xml

<?xml version=”1.0″ encoding=”iso-8859-1″?>
<!DOCTYPE View SYSTEM “view.dtd”>
  <View>
    <edit guiId=”myedit” value=”getValue” setValue=”setValue(?value)”/>
  </View>

Content of file main.xml

<?xml version=”1.0″ encoding=”iso-8859-1″?>
<!DOCTYPE View SYSTEM “view.dtd”>
  <View>
    <Include url=”basic.xml” alias=”incA”/>
    <Include url=”basic.xml” alias=”incB”/>
    …
    <tableLayout guiId=”myedits” rows=”p” cols=”p,p”>
      <placeTl row=”0″ col=”0″ id=”incA/myedit”/>
      <placeTl row=”0″ col=”1″ id=”incB/myedit”/>
    </tableLayout>
  </View>

As can be seen in this example, the include mechanism allows also to duplicate definitions. Without this duplication technique, one component identifier must not be used twice.