3.4. DOCTYPE Declaration

All WML documents must have the DOCTYPE declaration. It should be placed between the XML declaration and the <wml> element. Below is the DOCTYPE declaration for WML 1.3. You can simply copy and paste it into your WML files.


<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">


The DOCTYPE declaration specifies the name of the DTD (Document Type Definition) and the URL to the DTD. The DTD contains information about the syntax of the markup language. It defines what elements and attributes can be used in the markup and the rules that they should be used. For example, the DTD of WML specifies that the <card> element should be enclosed in the <wml></wml> tag pair. If you do not follow this rule, your WML document is said to be invalid. WAP browsers will complain if you try to view an invalid WML document.

If you are interested in the DTD of WML 1.3, it can be downloaded at http://www.wapforum.org/DTD/wml13.dtd.

If you want your WML code to conform to an earlier version of the WAP standard, you have to change the DTD.

This is the DTD declaration for WML 1.2:


<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml12.dtd">


This is the DTD declaration for WML 1.1:


<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">


Validation tools can be used to check whether your WML document conforms to the WML language rules by comparing your WML document with the DTD specified in the DOCTYPE declaration. Such validation tools are integrated in some IDEs.


Previous Page Page 4 of 50 Next Page


Feedback Form (ExpandCollapse)

What do you think about this web page?






(Optional) Please provide us more details. For example, suppose you select option 2 above, can you tell us specifically what information is missing? You can also suggest anything that can help us improve this web page.

(Optional) Your name:

(Optional) Your email address:

Please enter again to confirm:

Due to the amount of messages we received, we may not be able to reply to all messages.

A button for going back to the top of this page