![]() UJML Language Reference |
UJML is an XML-based programming language with a well-defined structure.
Note: If you are new to XML, see XML Tags, XML Entities. You should also search the Internet for more information and/or read some of the many excellent books on the subject. It is important to understand XML in order to read and write quality UJML code. The XML specification is managed by the World Wide Web Consortium.
UJML consists of a mix of XML tags and a textual procedural scripting language, although there is a form of the scripting language available which consists only of XML tags. See UJML Tags, Scripting Language. These tags have a well-defined structure which determines the layout of a UJML file. Every UJML file must be a 'well-formed' XML document.
The classic way to introduce a language is to display the phrase "Hello World!" This serves the dual purpose of showing the language syntax using the smallest possible example application and letting the language announce its presence. This documentation contains several different 'Hello World' samples, with varying levels of complexity, which you can examine and/or try running in your UJML development environment. See Hello World Samples.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ujml PUBLIC "-//UIEVOLUTION//DTD UJML 1.5//EN"
"http://www.uievolution.com/dtd/ujml-1.5.dtd">
<ujml>
<application>
<display>
<!-- Say Hello on the screen. -->
<label>
<text>Hello World!</text>
</label>
</display>
</application>
</ujml>
Note: This documentation contains a large collection of sample UJML applications, ranging from simple to advanced, each demonstrating language elements and techniques. See Samples.
Every UJML file starts with an XML processing instruction that indicates the XML version and character encoding. UJML files must be XML version 1.0. The encoding is not specified, but 'UTF-8' encoding is recommended.
<?xml version="1.0" encoding="UTF-8"?>
A DOCTYPE directive referencing the targeted UJML version and the correct DTD for the UJML version is required.
<!DOCTYPE ujml PUBLIC "-//UIEVOLUTION//DTD UJML 1.5//EN" "http://www.uievolution.com/dtd/ujml-1.5.dtd">
Optionally the DOCTYPE directive can include custom entity declarations.
<!DOCTYPE ujml PUBLIC "-//UIEVOLUTION//DTD UJML 1.5//EN"
"http://www.uievolution.com/dtd/ujml-1.5.dtd" [
<!ENTITY SALUTATION "Hello World!">
<!ENTITY SPACING "4">
<!ENTITY MOVEMENT "4">
]>A set of ujml start and end tags (a ujml element) contains the entire UJML program in the file. See ujml.
<ujml>
...
</ujml>Within the ujml tags is a set of application, partition, or component tags which contain the 'body' of the UJML file (the declarations and logic elements). See application, partition, component. The application element indicates that the file is a standalone UJML application which can operate by itself, or in conjunction with one or more partition files.
<ujml>
<application>
...
</application>
</ujml>
The partition element indicates that the file is a UJML module designed to be linked to at run time or included in another file.
<ujml>
<partition>
...
</partition>
</ujml>
The component element indicates that the file is a UJML component designed to be loaded and instantiated at runtime. The component element must implement one or more interfaces, which represent public functionality provided by the component.
<ujml>
<component>
<interfaces>
...
</interfaces>
</component>
</ujml>The body of a UJML file is the declarations and logic elements which actually do something. These are specified within an application or partition element and have a certain order in which they can occur. For a complete listing of all the elements, including dependencies and hierarchy, see UJML Tags.
The top-level body elements (those which may be directly contained by a partition or application element) and the order in which they can occur are:
|
Element |
Purpose |
|
Defines the state machines with the lowest z-order. See State Machines. | |
|
Declares the state variables within the scope of the application or partition. See State Variables. | |
|
Declares the variables within the scope of the application or partition. See Variables. | |
|
Defines the functions available within the scope of the application or partition. See User Defined Functions. | |
|
Defines the templates available within the scope of the application or partition. See Visual Element Templates. | |
|
Defines a script (either XML scripting or scripting language) that runs when the application or partition is first loaded into memory. See Scripting. | |
|
Declares any visual elements and event handlers that are activated when the application is first loaded into memory and stay activated until the application or partition is removed from memory. See Visual Elements. | |
|
Defines any state transitions in the application or partition. See State Transitions. | |
|
Defines the state machines with the highest z-order. See State Machines. |
Note: None of the top-level body elements is required, but there may be only one of each. The exception to this is the state-machines element, which may exist twice; once at the beginning and once at the end of the body.
|
Topic |
Description |
|
XML tags are words and symbols used to create UJML elements. | |
|
XML entities are symbols that are converted to other values when the XML file is interpreted. |
|
Copyright (c) 2000-2007 UIEvolution, Inc. All rights reserved.
|
|
What do you think about this topic? Send feedback!
|