TQS Home
Trivia Quiz Shell Version 2.8 Now Available!Bot Productions Home
 

Part I: XML and TQS Basics

TQS uses an XML-based file format to store all information for your program. Therefore, a brief explanation of XML, its benefits, and its syntax is required.

XML, which stands for Extensible Markup Language, is an industry standard for data storage and exchange. Based on SGML (Standard Generalized Markup Language), it is quite similar to HTML, but it has stricter rules for valid documents.

XML Documents are ordinary text files, and can be edited by any text editor, including Windows Notepad. While XML documents usually have a .xml file extension, TQS files have the extension .tqs. The main benefits of an XML-based format are ease of use, expandibility, and cross-platform compatibility.

Let's create a simple XML document. Open up Windows Notepad, or any other text editor of your choice, and create a new document. Then, type in the following line, which is necessary for any XML file:

<?xml version="1.0"?>

What is the purpose of this line? This code tells the Microsoft XML Parser, which TQS uses, that this is an XML document. It must be the first line in all TQS files that you create.

Add the following lines to your document:

<TQS VERSION="2.0">
</TQS>

What you have just entered is referred to in XML as the document element or root element. The TQS tag is used to tell the TQS program that indeed, this is a TQS file. All of the rest of the data that you enter into the file will go between the starting (<TQS>) and ending (</TQS>) tags.

An XML element is denoted by a beginning and ending tag. In this case, the tag name is TQS, and it uses separate opening and closing tags. Another way of marking a tag includes a final slash to close the element, as follows:

<TQS VERSION="2.0"/>

This syntax will not work for the TQS element, because you must place other elements inside the TQS element, between its tags. However, there will be other places where using this syntax is appropriate.

The text of an element is everything in between its opening and closing tags. In the folling element, for example, the text is Hello There!.

<SAMPLETAG>Hello There!</SAMPLETAG>

An XML element can also contain what is called an attribute. An attribute is specified by typing, within the tag but after the tag name, the attribute name, followed by equals, and then the value of the attribute in double quotes. VERSION="2.0" is an example of an attribute in the TQS tag. In this case, it specifies that this TQS document requires TQS version 2.0 or higher to work.

(Note: This tutorial covers TQS 2.1-specific features in Part XI, and TQS 2.5-specific features beginning in Part XII. In order to use these features, the VERSION attribute must be set to "2.1" or "2.5", respectively. Parts I through X will only cover TQS 2.0 features.)

Currently under development is the Trivia Quiz Shell Editor, which will allow for easy application creation without coding by hand. However, the editor will only recognize TQS documents that specify that they can be edited. The presence of the attribute EDITABLE set to the value of "1" will allow your application to be edited using the future TQS editor. You should put this in your document now to take advantage of this feature when it becomes available. Or, leave it out to prevent the editor from opening it.

So far, your TQS document should look like this:

<?xml version="1.0"?>
<TQS VERSION="2.0" EDITABLE="1">
</TQS>

Save your document under the name "tutorial.tqs". This file will not yet do anything, but it will load correctly into TQS as it is a valid TQS document.

In this section of the tutorial, you have learned the basics of XML, including elements, tag names, text, and attributes. You have started the creation of a functional TQS document. In the next section of the tutorial, you will give your application a title and add author information.

Part II: Title and Author Information


©2016 Bot Productions. All rights reserved.Last Updated: May 28, 2004