Fixit – XHTML Mobile Profile

This test attempts to determine if you are using markup appropriate for the mobile context. dotMobi recommends that you use XHTML Mobile Profile. You may use any of the markup specifications listed below which are optimised for mobile and satisfy this recommendation. In order to pass dotMobi compliance, your page should be delivered to the checker in one of these specifications

  • XHTML Mobile Profile 1.0
  • XHTML Mobile Profile 1.1
  • XHTML Mobile Profile 1.2
  • XHTML Basic 1.0
  • XHTML Basic 1.1

Each of these is a slightly different flavour of XHTML. For the curious, you might like to see this article which tabulates the differences between each.

To pass this test you need to use an acceptable markup language, and your markup must validate. To do this you need to ensure that you have correctly specified which Doctype you are using, and you need to ensure that you are using no tags outside of your specified markup, and that your document is well-formed and valid. If you are new to writing XHTML you might also take a look at the dotMobi web developer's guide.

Specifiying a DOCTYPE

The Document Type Declaration (DOCTYPE) associates your page with a Document Type Definitition (DTD). Simply copy the DOCTYPE declaration into your page directly after the xml declaration (which looks like: <?xml version="1.0" charset="UTF-8" ?>). Any of the doctype declarations below will do the trick:

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

XHTML Mobile 1.1:
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.1//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd">

XHTML Mobile 1.2:
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">

XHTML Basic 1.0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">

XHTML Basic 1.1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">

So the first couple of lines of your markup should look something like this:

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

A word of warning: each of these doctype declarations specifies a different DTD. There is much overlap between these DTDs, but there are also subtle differences. Some features of one specification may not be available in another. When you specify a particular DOCTYPE you are commiting to the features of that and only that specification. If, in your markup, you include features from another specification, outside the one you have declared, then the your page will not validate, and you will get errors in the ready.mobi Valid markup test.

Using correct tags

Once you have decided on which markup to use, be sure to use only tags that are valid for that specification. Refer to the comparison table if you are unsure about a particular tag. Ready.mobi checks to make sure you are using the correct XHTML tags. If you do not use the correct tags, you may fail the ready.mobi XHTML Mobile Profile test, and the Valid markup test.

Some simple tips for valid XHTML:

  • all your tags and attributes must be lowercase
    Correct: <div id="myDiv">Hello world!</div>
    Incorrect: <DIV ID="myDiv">Hello world!</DIV>
  • tags must be closed properly
    Correct: <div>Hello world</div>
    Incorrect: <div>Hello world!
    This also holds for singleton tags (tags that do not enclose any content). For example, the <br /> tag
  • tags must be nested correctly
    Correct: <div><strong>Hello world!</strong></div>
    Incorrect: <div><strong>Hello world!</div></strong> – In this case, all the tags are closed, but in the wrong order – they are not nested correctly
  • attribute values must be quoted
    Correct: <div id="myDiv">Hello world!</div>
    Correct: <div id='myDiv'>Hello world!</div>
    Incorrect: <div id=myDiv>Hello world!</div>

 

Relationship of XHTML Mobile Profile test and Valid Markup test

The dotMobi registrant compliance rules (specified in the Switch on guide) say that you should use Valid XHTML Mobile Profile in your page . For readability in the ready.mobi report, this compliance rule has been split into two separate tests – one to check for the use of XHTML Mobile Profile, and one to check for valid markup. Thus these two tests map back to one compliance rule, and the Valid Markup test is really a part of the XHTML Mobile Profile test. Therefore, if your markup does not validate then you will fail the Valid markup test, as well as the XHTML Mobile Profile test. If you only recieved one FAIL message for the XHTML Mobile Profile test:

Does not validate against -//WAPFORUM//DTD XHTML Mobile 1.0//EN

then you should check the Valid markup test for more details, and read this article to learn how to fix this.

 

Exclusive tips, how-tos, news and comment

Receive monthly updates on the world of mobile dev.

Other Afilias Products

Try the world’s leading device detection solution at
DeviceAtlas - Try the world’s leading mobile device detection solution

Evaluate your websites’ mobile readiness with
mobiReady - Evaluate your websites’ mobile readiness.

© 2020 Afilias Technologies Ltd. All rights reserved.

This is a website of Afilias Technologies Ltd, a private company limited by shares, incorporated and registered in the Republic of Ireland with registered number 398040 and registered office at 6th Floor, 2 Grand Canal Square, Dublin 2, Ireland