Cogs Verbix logo
Navigation
On-line services
Windows software
Search

Lesson 2: Basic syntax

 

Language extension code is XML

Verbix language extensions are based on XML code. If you open in Notepad the language extension mentioned in lesson 1, you will see something like listed below (line numbers are added here just as to make it easier to refer to the XML code).

XML code consists of the following:

  • XML Header: it's the first line of the code. In Verbix language extensions this line is always the same.
  • Elements: elements are always added in pairs, an opening element and a closing element. On row 7, opening element is <firstname> and closing element the same with slash, i.e. </firstname>. There can child elements or text between a pair of elements.
  • Child elements: Elements that are located between a pair of elements are called 'child elements', i.e., they are nested. E.g., <firstname> on line 7 is the child of <creator> element on line 6.
  • Text: Text is located between a pair of elements..
  • Attributes: attributes are located inside an opening element. E.g., on row 4 <created> element contains one attribute: format="dd.MM.yyyy"
  • Section: A section consists of multiple nested elements (elements and child elements).

Note! XML code is always case sensitive!

 1: <?xml version="1.0" encoding="Windows-1252"?>
 2:   <languages>
 3:     <file>
 4:       <created format="dd.MM.yyyy">7.5.2002</created>
 5:       <modified format="dd.MM.yyyy">7.5.2002</modified>
 6:       <creator>
 7:         <firstname>Erik</firstname>
 8:         <lastname>Lindberg</lastname>
 9:         <email>info@verbix.com</email>
10:         <web>www.verbix.com</web>
11:       </creator>
12:     </file>
13:     <language>
14:       <info>
15:         <name>Test language</name>
16:         <code>test</code>
17:         <created format="dd.MM.yyyy">7.5.2002</created>
18:         <status percentage="1">Under construction</status>
19:         <parser>
20:           <name>VerbiXML</name>
21:           <version>
22:             <major>1</major>
23:             <minor>0</minor>
24:             <sub>4</sub>
25:           </version>
26:         </parser>
27:       </info>
28:       <words>
29:         <verbs published="yes">
30:           <tenses>
31:             <item id="0" forms="1">Infinitive</item>
32:           </tenses>
33:           <rules>
34:             <check>
35:               <rule resulttype="1" >*</rule>
36:             </check>
37:           </rules>
38:           <code>
39:             <item type="1" tense="0" command="add">Hello %root%!</item>
40:           </code>
41:           <items>
42:             <item type="1">world</item>
43:           </items>
44:         </verbs>
45:       </words>
46:     </language>
47:   </languages>

Basic structure

Each Verbix language extension consists of two major sections: file section (lines 3-12) and language section (lines 13-46).

  • File section is located in the beginning of the file, and it includes basic information of the language extension. File section id followed by one or more language sections.
  • Each language section describes one language. Normally there is only one language section per file.

File section

File section includes the information of the creator of the language extension. Feel free to modify it.

Dates must always be entered in the same format as on line 4 and 5.

Language section

Language section is much more complicated, because it must contain all the information of the language and its conjugations.

Lesson 3 will discuss language section.

 
Content updated 13.09.2006
Literature sources
Contact verbix
© Verbix 1995-2006. http://www.verbix.com