3.2 :: Basic text

Your first WAPL


Lets start with a simple line of text. In keeping with tradition, here is an example that displays 'Hello World'.
  1.  <?xml version="1.0" encoding="UTF-8" ?>
  2.  <wapl xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://wapl.wapple.net/wapl.xsd">
  3.   <layout>
  4.   <easyChars>
  5.   <value>Hello World</value>
  6.   </easyChars>
  7.   </layout>
  8.  </wapl>
Downloadlisting 3.2.a

Examining 'Hello World'


If you are familiar with XML based languages, the above script is very simple and you may want to skip ahead.
If you are new to this, the following text may serve as a quick introduction to the world of WAPL and XML.

XML Declaration


WAPL is an XML based language. This is declared at the top of every WAPL file.
  1.  <?xml version="1.0" encoding="UTF-8" ?>
..snip..

Root element


Next is the WAPL root element which references the WAPL schema used to validate the document.
Like all elements in XML files, it must be closed. This happens at the last line of every WAPL file.
..snip..
  1.  <wapl xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://wapl.wapple.net/wapl.xsd">
  2.   <layout>
  3.   <easyChars>
  4.   <value>Hello World</value>
  5.   </easyChars>
  6.   </layout>
  7.  </wapl>

Page Layout


Everything that is actual page content is placed inside <layout> tags.
..snip..
  1.   <layout>
  2.   <easyChars>
  3.   <value>Hello World</value>
  4.   </easyChars>
  5.   </layout>
..snip..

easyChars - your first element


The easiest way to display text is to use an <easyChars> element.
..snip..
  1.   <easyChars>
  2.   <value>Hello World</value>
  3.   </easyChars>
..snip..

The <easyChars> element has a child element called <value> which contains the actual text to display - Hello World.
'Easy' elements come with simple formatting automatically applied. This means they are quick and easy to use but somewhat limited. Don't worry, as you learn more about WAPL you will find that there are plenty of ways to achieve far more advanced things.

Contents