XHTML MP is based on the W3C’s XHTML Basic, and they are almost the same. The W3C has an online mobile validator at http://validator.w3.org/mobile; it accepts XHTML Basic and MP as valid markup.
XHTML Mobile Profile is a subset of XHTML. It is XML-based, so we need to follow the strict rules. If you have never worked with XHTML 1.0 or 1.1 for the Web, let’s analyze the differences compared with working with HTML:
The file must have a root element (
Every tag name and tag attribute must be in lowercase.
Every attribute value must be enclosed in quotes.
Every tag must be closed. This may seem obvious, but it is not;
<br> don’t need
to be closed in HTML, but they do need to be closed in XHTML. The
general rule is to use self-closed tags, like
The tags need to be closed in reverse order. If you open a paragraph and then a link, you must close the link before closing the paragraph.
XHTML entities must be well formed. A mandatory space should be
and an ampersand
character should be
All attributes must have a value. For example,
<option selected> is invalid; you must
The DOCTYPE declaration is mandatory, and the XML opening tag is optional. In fact, for mobile browsers we should not insert the XML opening tag.