Adapt Web Content to Any Device
Use ASP.Net Mobile Controls to generate properly formatted
content for any XML language on any device
by Jeff Jurvis
February 2003 Issue
The proliferation of XML-based markup languages has forced developers to come up with smart options for automatically generating the proper markup for specific devices and delivery methods. For example, a Web-enabled mobile phone running a Wireless Access Protocol (WAP) browser is expecting a form of the Wireless Markup Language (WML). Even though WML is an XML document type, there are still a lot of differences in how individual browsers render WML on different devices. Some mobile devices have tiny displays with limited graphics capabilities, while other phones and WAP-enabled PDAs have larger displays and 256 colors. And it's not just rendering languagesdevices will have to support content encoded in SyncML, VoiceXML, SALT, and other XML-based formats.
A common solution to this problem is to format your content according to some XML schema and use XML style sheets to adapt the content to a specific device. A problem with this solution is the need to provide style sheets for each browser/markup/device combination, which can number in the hundreds. A different approach is to generate device-specific markup automatically through the use of Active Server Pages (ASP), Java Server Pages (JSP), Perl, or some other method of creating Web pages programmatically. To this end, Microsoft provides a special set of adaptive controls used with ASP.Net called ASP.Net Mobile Controls (Microsoft Mobile Internet Toolkit) that allows you to build a Web application in a .Net language such as Visual Basic .Net or C# and to have that application render correctly on more than 140 devices.
Developers extend the ASP.Net Mobile Controls by modifying existing controls and adding new controls, and by adding new device adapters and updating device capabilities. The mobile controls are tools like text boxes, lists, commands, validators, and other .Net classes that you can incorporate into ASP.Net pages by dragging and dropping them in the visual designer or by inserting them directly into ASP.Net code. When a browser requests one of your pages, ASP.Net will identify the browser type and use configuration files containing device characteristics to develop a detailed dossier on the browser's capabilities. ASP.Net Mobile Controls' device adapters will then render markup code that matches the language required by the browser (HTML, WML, CHTML, and XHTML) and will also adapt to the display size, scripting capability, and other device characteristics.
ASP.Net works as part of the .Net Framework, and the device adapters and mobile controls are .Net classes. ASP.Net Mobile Controls includes control classes and device adapter classes for HTML, WML, CHTML, and XHTML. The source code for many of the device adapter classes is included and accessible from Visual Studio .Net or any source code editor.
Let's look at what it would take to add support to ASP.Net for mobile devices that support XHTML and the Speech Application Language Tags (SALT). SALT is a small set of tags that add listening and prompting to SGML-compliant markup languages so that browsers can accept input by voice recognition and can deliver output by speech synthesis. As an example, I'll invent a mobile device with a browser that renders XHTML Mobile Profile with SALT added (XHTML+SALT). We can extend the XHTML select element with the SALT listen element so that a user can choose a selection using point and click or can choose to speak their selection.
To add this capability to ASP.Net Mobile Controls, we need to follow a few steps (see Figure 1). The version of the mobile controls that I'm using has XHTML device adapters that are subject to change, but the process of extending the adapters will stay the same, and the code will likely be very close if not identical to that released this fall with ASP.Net Mobile Controls Device Update 2 (see Microsoft's list of supported devices at www.asp.net). We'll base our new adapter on XHTML and start with the .Net classes in the XhtmlAdapterSet. I created a new Visual Studio .Net project called XHTMLSALTAdapterSet that will
generate a new assembly called "XHTMLSALTAdapterSet" that will be made up of the custom classes we need to add SALT support to the XHTML controls.
Back to top
|