- XML Reference Guide
- Overview
- What Is XML?
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Table of Contents
- The Document Object Model
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- DOM and Java
- Informit Articles and Sample Chapters
- Books and e-Books
- Implementations
- DOM and JavaScript
- Using a Repeater
- Repeaters and XML
- Repeater Resources
- DOM and .NET
- Informit Articles and Sample Chapters
- Books and e-Books
- Documentation and Downloads
- DOM and C++
- DOM and C++ Resources
- DOM and Perl
- DOM and Perl Resources
- DOM and PHP
- DOM and PHP Resources
- DOM Level 3
- DOM Level 3 Core
- DOM Level 3 Load and Save
- DOM Level 3 XPath
- DOM Level 3 Validation
- Informit Articles and Sample Chapters
- Books and e-Books
- Documentation and Implementations
- The Simple API for XML (SAX)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- SAX and Java
- Informit Articles and Sample Chapters
- Books and e-Books
- SAX and .NET
- Informit Articles and Sample Chapters
- SAX and Perl
- SAX and Perl Resources
- SAX and PHP
- SAX and PHP Resources
- Validation
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Document Type Definitions (DTDs)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XML Schemas
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- RELAX NG
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Schematron
- Official Documentation and Implementations
- Validation in Applications
- Informit Articles and Sample Chapters
- Books and e-Books
- XSL Transformations (XSLT)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XSLT in Java
- Java in XSLT Resources
- XSLT and RSS in .NET
- XSLT and RSS in .NET Resources
- XSL-FO
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XPath
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XML Base
- Informit Articles and Sample Chapters
- Official Documentation
- XHTML
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XHTML 2.0
- Documentation
- Cascading Style Sheets
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XUL
- XUL References
- XML Events
- XML Events Resources
- XML Data Binding
- Informit Articles and Sample Chapters
- Books and e-Books
- Specifications
- Implementations
- XML and Databases
- Informit Articles and Sample Chapters
- Books and e-Books
- Online Resources
- Official Documentation
- SQL Server and FOR XML
- Informit Articles and Sample Chapters
- Books and e-Books
- Documentation and Implementations
- Service Oriented Architecture
- Web Services
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Creating a Perl Web Service Client
- SOAP::Lite
- Amazon Web Services
- Creating the Movable Type Plug-in
- Perl, Amazon, and Movable Type Resources
- Apache Axis2
- REST
- REST Resources
- SOAP
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- SOAP and Java
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- WSDL
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- UDDI
- UDDI Resources
- XML-RPC
- XML-RPC in PHP
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Ajax
- Asynchronous Javascript
- Client-side XSLT
- SAJAX and PHP
- Ajax Resources
- JSON
- Ruby on Rails
- Creating Objects
- Ruby Basics: Arrays and Other Sundry Bits
- Ruby Basics: Iterators and Persistence
- Starting on the Rails
- Rails and Databases
- Rails: Ajax and Partials
- Rails Resources
- Web Services Security
- Web Services Security Resources
- SAML
- Informit Articles and Sample Chapters
- Books and e-Books
- Specification and Implementation
- XML Digital Signatures
- XML Digital Signatures Resources
- XML Key Management Services
- Resources for XML Key Management Services
- Internationalization
- Resources
- Grid Computing
- Grid Resources
- Web Services Resource Framework
- Web Services Resource Framework Resources
- WS-Addressing
- WS-Addressing Resources
- WS-Notifications
- New Languages: XML in Use
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Google Web Toolkit
- GWT Basic Interactivity
- Google Sitemaps
- Google Sitemaps Resources
- Accessibility
- Web Accessibility
- XML Accessibility
- Accessibility Resources
- The Semantic Web
- Defining a New Ontology
- OWL: Web Ontology Language
- Semantic Web Resources
- Google Base
- Microformats
- StructuredBlogging
- Live Clipboard
- WML
- XHTML-MP
- WML Resources
- Google Web Services
- Google Web Services API
- Google Web Services Resources
- The Yahoo! Web Services Interface
- Yahoo! Web Services and PHP
- Yahoo! Web Services Resources
- eBay REST API
- WordML
- WordML Part 2: Lists
- WordML Part 3: Tables
- WordML Resources
- DocBook
- Articles
- Books and e-Books
- Official Documentation and Implementations
- XML Query
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XForms
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Resource Description Framework (RDF)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Topic Maps
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation, Implementations, and Other Resources
- Rich Site Summary (RSS)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Simple Sharing Extensions (SSE)
- Atom
- Podcasting
- Podcasting Resources
- Scalable Vector Graphics (SVG)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- OPML
- OPML Resources
- Summary
- Projects
- JavaScript TimeTracker: JSON and PHP
- The Javascript Timetracker
- Refactoring to Javascript Objects
- Creating the Yahoo! Widget
- Web Mashup
- Google Maps
- Indeed Mashup
- Mashup Part 3: Putting It All Together
- Additional Resources
- Frequently Asked Questions About XML
- What's XML, and why should I use it?
- What's a well-formed document?
- What's the difference between XML and HTML?
- What's the difference between HTML and XHTML?
- Can I use XML in a browser?
- Should I use elements or attributes for my document?
- What's a namespace?
- Where can I get an XML parser?
- What's the difference between a well-formed document and a valid document?
- What's a validating parser?
- Should I use DOM or SAX for my application?
- How can I stop a SAX parser before it has parsed the entire document?
- 2005 Predictions
- 2006 Predictions
- Nick's Book Picks
Depending in your target audience, you may have options for cell phone development other than WML. Most modern cell phones have some support for XHTML Mobile Profile, or XHTML-MP, though their support for features such as CSS and specifically color and graphics will naturally be determined in part by the capabilities of the actual phone. (I, for example, still use a Motorola i205, which has a tiny little screen and no color. So while it uses the Openwave browser we've been seeing in the simulator, advanced pages won't appear the same way on my phone.)
That said, let's take a look at what XHTML-MP actually is and how to put it to use.
One thing I haven't talked about here in the guide (yet) is the notion of XHTML Modularization. One of the good things brought on by the so-called "browser wars" of the 1990's was the understanding that not all browsers -- and browser-like applications -- are created equal, and that there needed to be a "standard" way of figuring out just what capabilities were available in which browsers. I'm not going to go into a full discussion of XHTML Modularization here, but I will tell you that there is a particular "flavor" of XHTML, XHTML-Basic, which is intended to provide a simple set of elements to provide the most basic capabilities typical browser should need.
XHTML-MP takes the tags defined by XHTML-Basic, adds a few more, and calls it a day. Let's look at what's actually supported:
Module | Elements |
---|---|
Structure | body , head , html , title |
Text | dfn , div , em , h1 , h2 , h3 , h4 , h5 , h6 , kbd , p , pre , q , samp , span , strong , var |
Hypertext | a |
List | dl , dt , dd , ol , ul , li |
Basic forms | form , input , label , select , option , textarea |
Basic tables | caption , table , td , th , tr |
Image | img |
Object | object , param |
Meta information | meta |
Link | link |
Base | base |
Additional elements/attributes not included in XHTML Basic: | |
Forms | fieldset , optgroup |
Legacy | start attribute on ol , value attribute on li |
Presentation | b , big , hr , i , small |
Style sheet | style element |
Style attribute | style attribute |
All of this means that the WML page we created in the previous section takes on a much more traditional look in XHTML-MP:
<?xml version="1.0" encoding="UTF-8"?> <!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" xml:lang="en"> <head><title>Tutorial request</title></head> <body> <form action="http://www.nicholaschase.com/informit/tutorials.php" method="post"> <p>My name is:</p> <input type="text" /> <p>I'm interested in authoring in:</p> <select name="languagetype"> <option value="WML">WML</option> <option value="XHTML-MP">XHTML-MP</option> <option value="XHTML-Basic">XHTML-Basic</option> </select> <input type="submit" value="Submit form" /> </form> </body> </html>
Notice the following about this page:
- The
DOCTYPE
is specified as the WAP Forum version of XHTML-MP. There is a second version that is published by browser-maker Openwave that includes tags supported only by them, but for obvious reasons, we'll stick to the standard. - Unlike in the WML document, we actually need the
form
element. - The response to the form is not part of the document. This is an important point, because it points out a major difference between WML and XHTML-MP. In the former, you can have several "pages" with a single connection to the server. In XHTML-MP, each page is a new round-trip to the server. Cell phones don't have great bandwidth, so keep that in mind when designing your application.
Another point to notice about XHTML-MP versus WML is that XHTML-MP doesn't know
anything about the actual phone itself. While we could look for the "accept" action in
a WML deck, we can't do that with XHTML-MP. We can, however, take advantage of the
accesskey
attribute in XHTML to simulate some of the "phone-like"
behavior we saw previously. For example:
<?xml version="1.0" encoding="UTF-8"?> <!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" xml:lang="en"> <head><title>Tutorial request</title></head> <body> <p>I'm interested in authoring in:</p> <ol> <li><a href="wml.html" accesskey="1">WML</a></li> <li><a href="xhtmlmp.html" accesskey="2">XHTML-MP</a></li> <li><a href="xhtmlbasic.html" accesskey="3">XHTML-Basic</a></li> </ol> </body> </html>
As you can see in the image, the ordered list puts the numbers next to each item,
and the accesskey
tells the browser to follow the link when the user
presses the appropriate key.
Another way that XHTML-MP is similar to "regular" XHTML is the ability to use
Cascading Style Sheets, or CSS. You can do this either through the style
attribute (to add style information to a particular element) or using the link
element to add a style to the overall page, as in:
... <head><title>Tutorial request</title> <link href="style.css" rel="stylesheet" type="text/css"/> </head> <body> ...
Supported styles will vary by phone, of course, so be sure to stick with styles that are not crucial to the page; color as a decoration, but not an indication of required fields, for example. For more information on CSS, check out the CSS entry in this guide, or better yet, the Web Design Reference Guide.