- Wireless Markup Language--Beyond the Basics
- Events, Tasks, and History
- Timers
- Tasks
- Deck Declarations
- Named Character Entities
- Scripting
Named Character Entities
WML named and numeric character entities are useful when you need to display a WML reserved character. For example, the less-than character "<" is normally interpreted as an element start character. However, named entities provide a readable way to insert reserved characters in display text. Most of the WML entities are defined in the XML specifications and include these:
|
& |
|
' |
|
> |
|
< |
|
|
|
" |
|
­ |
Recall from our discussion of variables that the dollar sign is used to reference a variable value. To display a dollar sign in WML text, you must use two consecutive dollar signs. For example: The cost is $$ $price will display as The cost is $100.00 when the variable price has the value 100.00.
Figure 5 shows how named character entities can be used.
. . . <p> Cream content in homogenized milk must be >= 3%. Temperatures of cheese & milk should be < 5 degrees. </p> . . .
Figure 5 Named character entities
The >, &, and < characters are used to reduce text size. The nonbreaking space is used to ensure that the words must and be are kept on the same line.
Note that the named character entities can also be expressed as hexadecimal or decimal numbers. For example, the named character entity `quot' could also be written as " or ".