7. XHTML MP Document Structure


7.1. Hello World XHTML MP Example

Here is our first XHTML MP example. It shows the structure of a typical XHTML MP document.


(helloWorldEg1.xhtml)

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>XHTML MP Tutorial</title>
  </head>

  <body>
    <p>Hello world. Welcome to our XHTML MP tutorial.</p>
  </body>
</html>


This is what you will see in some mobile phone emulators:


Sony Ericsson T610


Nokia Mobile Browser 4.0


XHTML MP documents start with the prolog, which contains the XML declaration and DOCTYPE declaration.


<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">


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

The rest of the document is the same as an ordinary HTML document, except that there should be no xmlns attribute for the <html> tag in HTML.

XHTML MP documents must contain the <html>, <head>, <title>, and <body> elements.


Previous Page Page 8 of 36 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