SolutionsTools & SDKSupportForums Register



Quick Links
 
XHTML-MP Style Guide Chapter 2 - XHTML MP in practice
 
 
In the previous chapter we looked at the history of XHTML MP and the building blocks of the mark-up itself. If your background is HTML development, you may have the impression that XHTML MP is similar to HTML, but with added complexity. This is both true and false. The whole point of XHTML MP is to give web developers a cheap ticket to wireless programming. For this reason, the Openwave browser and most of the browsers out there will not be too fussy about invalid (i.e. non DTD-compliant) XHTML MP or even poorly-formed mark-up. While W3C-oriented minds often refer to good old HTML as "tag-soup," the industry has made a point to retain that simplicity; browsers should be forgiving rather than strict.

In this regard, the Openwave browser is very forgiving when it comes to mark-up. If you avoid adding the XML processing instruction and the DTD, your code will still work. Unrecognized tags and CSS properties will be ignored and tags without a closure won't break your page (e.g. <br> instead of <br/> and <p> without a matching </p>).

To be totally honest, the XHTML-MP DTD is very strict and there are commonly accepted HTML constructs which break validation. One example of this is:
   <body>Hallo Reader</body> 

which should be coded as:
   <body><p>Hallo Reader</p></body> 

If, for whatever reason, you want your code to make it through a validating parser (the one at W3C, for example http://validator.w3.org/ ), your application must comply with whichever DTD you declare.

It is important to note that we are not advocating that developers write sloppy mark-up; we simply wanted to make sure that the previous chapter did not scare you.


Not all Browsers are created equal
 
Writing an XHTML style guide in a time when only first-generation browsers have hit the market is difficult since only limited understanding exists of how different browsers behave in different situations. This style guide focuses on the Openwave browser and refrains from analyzing browsers from other vendors because it is too soon to know which browsers will actually conquer a consistent market share and be relevant, and which ones are merely proof-of-concept browsers which fail to comply to the features that the XHTML-MP specs demand.

We do understand that developers may find themselves in the situation of having to code for browsers other than Openwave's. Whenever possible, we will also mention the pitfalls that you may encounter when coding for other browsers.


Non Openwave browsers
 
The Openwave browser stands out from the crowd in its support for XHTML and CSS. Some of the problems that have been observed with browsers from other vendors include:
  • Poor or no CSS support
  • No table support
  • Cell borders always drawn around table cells
  • Images shown centered and/or on a line of their own
  • Hyperlinks are shown on a line of their own
  • No support for the accesskey attribute
  • Counterintuitive support for forms (combo boxes, radio buttons and input fields)
  • Presenting users with a secondary screen to capture input

The Openwave Browser
 
While the Openwave browser has great support for all the features mentioned in the XHTML MP specs, the supported feature set extends beyond this. Readers with a WML or HDML background know that those languages offer features that do not exist in HTML. Some of those features are useful in helping developers create usable applications (remember, usability is paramount when it comes to wireless applications).

For example, programmers can add a format attribute to their input fields and let the browser know the format of the expected user input. While the attribute has no history in HTML, those with a background in WML or HDML will recognize the importance of this feature, as input can be automatically forced into numeric or alpha mode with no user interaction.

Other WML-inspired extensions are the mode and wrap attributes for the <p> tag (which allows times-square horizontal scrolling) and the localsrc attribute for built-in icons with the <img> tag.


Authoring XHTML MP for the Openwave Browser vs. Authoring for Other Browsers
 
If you are coding specifically to the Openwave browser, the available extensions are great features to build great looking applications with superior usability. If you need to address multiple browsers, we suggest that you examine the possibility of multi-serving your application -- coding multiple versions of your application or using a multi-serving framework of some kind (see Appendix B for more details). At the time of this writing, the great majority of mobile phones still support WML 1.X exclusively, so you may need to multi-serve applications anyway.


What comes next?
 
In the next chapter, we'll get into the guts of building XHTML applications by starting with a look at some ways to build menu structures in XHTML-MP.


XHTML-MP Style Guide Chapters
 
XHTML-MP Style Guide Index
1. History of XHTML Mobile Profile
2. XHTML MP in practice
3. Menus in XHTML Mobile profile 1.0
4. Text-flow
5. Forms: Collecting User Data
6. Images and Objects
7. Testing Your Applications
Appendix A
Appendix B


 
 
Copyright © 2000-2008 Openwave Systems Inc.    About Us  |  Openwave  |  Terms & Conditions  |  Privacy Policy  |  Update Profile