WML Syntax - WML

What is WML Syntax?

While , A WML program is categorized into two parts: the document prolog and the body. Consider the following code:

Following is the basic structure of a WML program:

WML Document Prolog:

The first line of this text depicts that this is an XML document and the version is 1.0. The second line tells us that the document type and gives the URL of the document type definition (DTD). The DTD referenced is noted as WAP 1.2, but this header changes with the versions of the WML. Here the header must be copied exactly so that the tool kits automatically generate this prolog.

The prolog components are not completely WML elements and they should not be closed, i.e. you should not give them an end tag or finish them with />.

WML Document Body:

The body is enclosed within a <wml> </wml> tag pair. The body of a WML document includes following things:

  • Deck
  • Card
  • Content to be shown
  • Navigation instructions

Unlike HTML 4.01 Transitional, text cannot be enclosed directly in the <card>...</card> tag pair. So you need to put a content inside <p>...</p> as shown above.

Testing Your Program:

Let’s add the above mentioned code in a file called test.wml file, and place this WML file locally on your hard disk, then view it using an emulator.

This is the most efficient way of developing and testing WML files. To develop a service that is going to be available to WAP phone users, you need to upload your WML files onto a server once you have developed them locally and test them over a real Internet connection. As you start developing more complex WAP services, this is how you will identify and rectify performance problems, which could, if left alone, lose your site visitors.

While uploading the file test.wml to a server, it will be testing your WML emulator to check how it looks and behaves, and checking your Web server to see that it is set up correctly. Let’s start your emulator and use it to access the URL of test.wml. For example, the URL might look something like this:

NOTE: Before accessing any URL, make sure WAP Gateway Simulator is running on your PC.

While you are downloading your WAP program, then you will see only first card at your mobile. Here’s the output of the above example on Nokia Mobile Browser 4.0. This mobile supports horizontal scrolling. Let’s have a look of the text off the screen by pressing the "Left" or "Right" button.

wap-example1

When you press right button, then second card will be visible as follows:

wap-example2

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

WML Topics