Example

The example application file

The example file for an application xml-file called myapplication.xml file, the lines are numbered for explanation means, they should not be numbered in the file:
  1. <?xml version="1.0"?>
  2. <!DOCTYPE application SYSTEM "application.dtd" [
  3. <!ENTITY window1 SYSTEM "window1.xml">
  4. <!ENTITY window2 SYSTEM "windowi2.xml"> ] >
  5. <application id="myapplication" guiversion="1.0">
  6. &window1;
  7. &window2;
  8. </application>

The first line introduces the necessary line to indicate that it is an XML-file. This line is obligatory to be able to parse the file.

Line 2 declares the DTD that is used.

Line 3 and 4 declare the windows that are used in this application.

Line 5 opens the application tag with the required attributes.

Line 6 and 7 import the window1.xml and window2.xml files in the application.

Line 8 closes the application tag.

The example window1 file

  1. <window id="window1" guiversion="1.0" text="Main window" mainwindow="true" layout="border" visible="true">
  2. <button id="button1" text="hello" position="top"/>
  3. <button id="button2" text="world" position="bottom"/>
  4. <button id="button3" text="hello" position="left"/>
  5. <button id="button4" text="world" position="right"/>
  6. <button id="button5" text="hello world"/>
  7. </window>

Line 1 opens the window tag. This window is the mainwindow as indicated by the mainwindow attribute. The layout of this window is the borderlayout. And the visible attribute says it is visible on startup.

Line 2 introduces a button with the text hello. It's position is at the top of the window.

Line 3 introduces a button at the bottom position.

Line 4 introduces a button at the left position.

Line 5 introduces a button at the right position.

Line 6 specifies a button with no position attribute. This means that the default center is used.

Line 7 closes the window tag.

The example window2 file

  1. <window id="window2" guiversion="1.0" text="Window2" mainwindow="false" layout="horizontal" visible="false">
  2. <button id="button6" text="hello" />
  3. <button id="button7" text="world" />
  4. <button id="button8" text="hello" />
  5. <button id="button9" text="world" />
  6. <button id="button10" text="hello world" />
  7. </window>

The first line opens the window tag. It's not the mainwindow because the mainwindow attribute has the value false. It also is not visible at startup. The window has a horizontal layout with a begin layoutalign (the default, it is not specified in the file it self).

Line 2 to 6 introduces 5 buttons which are next to each other with the first button at the left.

Line 7 closes the window tag.