Page 50 - DCAP512_WAP_AND_WML
P. 50
WAP & WML
Notes deck. When users want to navigate from one card in the deck to another, there should be a
mechanism to differentiate the cards.
Below we are see some of the elements that a card may contain.
Paragraphs - To have a formatted text in the user screen, a text can be broken into paragraphs.
The paragraph element has align attribute, whose value may be center, right or left. Also the
paragraph element has mode attribute, whose value may be wrap and nowrap.
Character Encoding
All the text in the cards of an WML application has appeared faithfully in the microbrowser to be
viewed by the users. But there are some characters that are intended to convey very specific
information to the microbrowser and not for users consumption. For instance ‘<‘ in a code like
x < y + z. Here microbrowsers on encountering the < character will look for a closing tag. But
there is no closing tag and this will result in error as WML is very strict about the tag rules as
WML is an application of XML. Actually ‘<‘ is a reserved character in WML. There are two kinds
of ways for outputting such kinds of reserved characters. They are numeric character entities and
named character entities.
Numeric Character Entities are actually an alternative means of expressing any character, not
just reserved ones. Every character that may be displayed has a number associated with it and by
referring to that number in a WML code, one can make the corresponding character to be
displayed.
Task Analyze how the numbers which WML uses to represent characters are borrowed
from Unicode?
Named Character Entities work in broadly the same way as numeric ones. They are not defined
for all characters and serve as an easy way to remember the representations of some of the
reserved characters the developers have to display often. This representation makes the WML
code easier to read. The above code can be displayed using x < y + z.
Line Breaks - Different WAP-enabled devices have different screen sizes and even if they use the
same microbrowser, there is no guarantee that the applications will look the same. This is
because of the fact that number of characters per line is varying according to the screen size. This
makes the sentences and paragraphs to wrap in a different manner. Also there may be occasions,
such as forcing a line break between two words, preventing line break from occurring between
two words or enforcing a word to be split across two lines. The <br> element is used to force a
line break between two words in a paragraph. <br> element has no content and it is always
empty.
The non-breaking space character entity ; is used to prevent a line break between two words.
The last layout control is - character entity, which is used to add a discretionary hyphen. This
means that the microbrowser may add a line break at its location and if it does, it should also add
a hyphen.
There are controlling elements in WML for manipulating the appearance of content. The
<b> element is used to make text use a bold font, while the <i> element is used to italicize
text. The <em> element makes the text emphasized. There are some other controls such as
<small>, <strong>, <big> to facilitate distinguishing text contents. Thus adding and
formatting text-based content can be accomplished through the use of paragraphs, elements
and entities.
44 LOVELY PROFESSIONAL UNIVERSITY