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


A button for going back to the top of this page