Java Reference
In-Depth Information
The helloworld WML Card
<?xml version=”1.0”?>
<card id=”helloworld” title=”Hello World”>
Hello World!
The code in Listing 24.1 reveals a few WML basics. Lines 1 and 2 are clearly the WML
header; this code will remain unchanged for all valid WML 1.1 files. The WML body begins
with the <wml> tag and dives immediately into our first card (named “helloworld” ). Note the
two attributes of the <card> tag: id and title . id is used to specify a unique ID for a card
within a single deck; the title attribute is optionally displayed to the user in the browser title
bar, depending on which browser is being used. The <p></p> tag pair is used to bracket a
paragraph of text, just as the <p></p> tag pair is used in HTML. It is also important to re-
emphasize, before continuing further, that XML is a case-sensitive language.
Text Formatting Tags
As you might expect, WML provides the full complement of text formatting tags (for line
breaks, italics, bold text, and so forth) as well as an anchor tag for hyperlinking to other cards
or documents. The following code snippets give brief examples for the usage of some of the
more popular WML tags to perform common programming tasks. For a complete description
of all WML tags, see Appendix F, “WML Tag Reference.”
This snippet illustrates the use of the <b></b> , <i></i> , <u></u> , and <big></big> tags to
format text display:
<b>This is bold text!</b>
<i>This is italic text!</i>
<u>This is underlined text!</u>
<big>This is BIG text!</big>
Listing 24.1 demonstrated the use of the <p></p> tag pair to delineate a paragraph of text. The
following snippet illustrates the use of the <br></br> tag pair:
<b>This is bold text!</b><br/>
<i>This is italic text!</i><br/>
<u>This is underlined text!</u><br/>
<big>This is BIG text!</big><br/>
Search WWH ::

Custom Search