The goal of this demo is to show how the DTD tool of the CLaRK system can be used.
Each document in the system is loaded with respect to some XML DTD. For this reason at least one DTD must be compiled in the system.
The layout (Tree and Text) of the documents in the system also depends on DTDs.
The goal here is to show how DTDs are compiled in the system.
In order to compile a DTD you have to perform the following steps:
Compile DTD
tool from the menu item DTD
- a standard File
Chooser appears.Dtd
- teixlite2x.dtd
file.Files of Type:
combo box select the appropriate Encoding - ASCII Text File
.Open
button. If there is no DOCTYPE
defined in the dtd, a
dialog with list of all elements in the DTD appears and the user is asked to select the DOCTYPE -
TEI.2
(the root element for documents using that DTD).A message for successful compilation appears. DTD is saved in the system with the name of the file containing it.
The goal here is to show how the user can view and edit DTDs in the system.
In order to view a DTD you have to perform the following steps:
Edit DTD
tool from the menu item DTD
- list of all DTDs
compiled in the system appears.teixlite2x.dtd
from the list of all DTDs. The information data is divided into four
sections representing different parts of the DTDs (structure data, attributes data, entities data and
processing-instructions data). Elements
table. The table contains two columns - the
name of the element - Element Name
and how the element is defined - Element
Description
. Attributes
panel. In order to see the attributes of a given
element, the user has to choose the element from the Choose an element :
drop-down menu at the
top of the window. This menu contains all the elements declared in the DTD. Attributes for that element are shown in
the table below. If after choosing an element, nothing appears in the table, it means that there are no attributes
declared for this element. Each time an element is chosen, the content of the table is updated.The table contains
tree columns - the name of the attribute - Attribute Name
, its type - Attribute Type
and the default values for attributes - Attribute Default Values
.Entities
table. The table contains two columns - the name
of the entity - Entity Name
and its description - Entity Value
.Processing Instructions
table, but
the instructions have not been processed so far.Each row in the tables describes exactly one feature and the user can edit it by double click.
Our goal here is to show how by editing the DTD text layout, the user can change the way, in which a document, loaded in the system, will appear on the screen.
This facility includes the following: moving to a new line before/after opening/closing tag, hiding some tags and/or their content.
In order to edit the DTD layout you have to perform the following steps:
Edit Text Layout
tool from the menu item DTD
- list of all DTDs
compiled in the system appears.teixlite2x.dtd
from the list of all DTDs. A table for editing the layout appears.The first
column contains all tag names in the DTD. Each row represents the layout information for one tag. Open tag start
in order the opening tag of the corresponding element to appear on a new
line. Select it for div0
, head
, p
, trailer
and
w
elements.Open tag end
in order the first child node of the corresponding node to appear on a new
line (a new line after the opening tag).Close tag start
in order the closing tag of the corresponding element to appear on a new
line. Select it for div0
element.Close tag end
in order a new line to be inserted after the closing tag.Is tag visible
in order to make the tag to be visible or hidden on the screen. By default,
the tag is visible.Are children visible
in order to hide or visualize the content of the tag.Use line offsets
in order to have more
comprehensive visualization. It suggests an additional white space to be inserted in front of the tags - the number
of spaces can be set by the user. If chosen, white spaces are assigned to each tag, which appears on a new line
and the length of the white space depends on the depth of the node in the DOM tree.When a document is loaded, it obeys the layout, defined for its DTD. Note that later on this layout can be changed for the current view.
Here is an example of how the document will look like in our case:
Our goal here is to show how by editing the DTD tree layout, the user can change the way, in which the document tree will be displayed on the screen.
Without a Tree Layout option activated the tree appears in the following way: element nodes are represented by their tag names, text nodes - by their text context. The nodes in the tree are colored in blue if the corresponding (DOM) nodes are valid with respect to the DTD, and colored in red otherwise. When a Tree Layout is activated the user can define the way each element node is represented in the tree.
In order to edit DTD tree layout you have to perform the following steps:
Edit Tree Layout
tool from the menu item DTD
- list of all DTDs
compiled in the system appears.teixlite2x.dtd
from the list of all DTDs. A table for editing the layout appears.The first
column Element
contains all tag names in the DTD. The second column Pattern
defines what will be shown instead of the element - the Instructions
button gives a short
description of the text pattern syntax. The last column Color
shows how the pattern will be
colored. Each row represents the layout information for one tag. Pattern
text field of head
element write the following head :
{text()}
and select Red
color.Pattern
text field of p
element write the following p type =
{parent::*/@type}
and select Cyan
color.Pattern
text field of pt
element write the following {text()}
and select Gray
color.Pattern
text field of w
element write the following {text()}
and select Green
color.Pattern
text field of trailer
element write the following author :
{text()}
and select Magenta
color.Enable Layout
check boxOK
button.
Each layout can be enabled/disabled. When a layout is disabled the tree is shown as if there is no layout defined but it still remains in the memory and can be enabled later.
The layout is saved in treeLayout.lt
file in the demo directory.
Below you can see how the above tree layout changes the tree appearance:
Tree Layout enabled
Tree Layout disabled