User Tools

Site Tools


document_definition

Document Definition

Structure

Every CML based application requires a main document file. In HTML this is often referred to as the index page. The main CML document must adhere to the following structure:

Main CML document

<?xml version="1.0" encoding="UTF-8"?>
<cml>
</cml>

The first line is the XML declaration. It defines the XML version (1.0) and the encoding used (Unicode Transformation Format-8. character set). For more information on XML visit the w3schools website: W3schools

The next line describes the root element of the document. The tag name cml indicates that this document is a Gestureworks application.


Content

The content of CML-based applications will be authored between the opening and closing root cml tag. The following example will load and display an external image file:

Example: Load and display an external image

<?xml version="1.0" encoding="UTF-8"?>
<cml>
    <Image id=”img1” src=”myImage.png” />
</cml>

Attributes

The cml tag possesses six often used attributes.

Attribute Type Description
css text loads an external cascading style sheet
gml text loads an external gestureML file
relativePaths true/false true : sets the file paths relative to the application that loads the main CML document file
false (default) : sets file paths relative to the main CML document file
rootDirectory text prepends a file path to every path defined within the CML document
simulator true/false true : enables the simulator and changes the input stream from native touch to mouse
false (default) : disables the simulator and sets the input stream to native touch
tuio true/false true : changes the input stream form native touch to tuio
false (default) : sets the input stream to native touch

The following demonstrates how to apply the listed attributes.

Example: Applying the listed attributes

<?xml version="1.0" encoding="UTF-8"?>
<cml rootDirectory="../assets/" relativePaths="true" gml="my_gestures.gml" css="my_styles.css" tuio="false" simulator="false">
     <Image id=”img1” src=”myImage.png” />
</cml>
document_definition.txt · Last modified: 2015/09/03 13:13 by glass