1 / 18

Dickson K.W. Chiu PhD, SMIEEE Thanks to Prof. S.C. Cheung (HKUST)

CSIT600b: XML Programming WML. Dickson K.W. Chiu PhD, SMIEEE Thanks to Prof. S.C. Cheung (HKUST). Wireless Application Protocol (WAP). Leading standard for information services on wireless terminals like digital mobile phones. Based on Internet standards (HTML, XML and TCP/IP).

malina
Télécharger la présentation

Dickson K.W. Chiu PhD, SMIEEE Thanks to Prof. S.C. Cheung (HKUST)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSIT600b: XML Programming WML Dickson K.W. Chiu PhD, SMIEEE Thanks to Prof. S.C. Cheung (HKUST)

  2. Wireless Application Protocol (WAP) • Leading standard for information services on wireless terminals like digital mobile phones. • Based on Internet standards (HTML, XML and TCP/IP). • Consists of • WML language specification • a WMLScript specification • a light JavaScript language • not embedded in the WML pages • WML pages only contains references to script URLs • need to be compiled into byte code on a server • a Wireless Telephony Application Interface (WTAI) specification • Published by the WAP Forum • founded in 1997 by Ericsson, Motorola, Nokia, and Unwired Planet • Forum members now represent over 90% of the global handset market, as well as leading infrastructure providers, software developers and other organizations. Dickson Chiu-2004

  3. Wireless Markup Language (WML) • WML based on XML and HTML. • WML documents are divided into a set of cards, each representing one unit of interaction between the user and the user agent. • Instructions embedded within cards may invoke services on origin servers. • Several cards are grouped into a deck, the basic WML unit, that origin server can send to a user agent. • See: http://www.w3schools.com/wap/default.asp Welcome to MTM515!! Emulator - http://ttemulator.com/ Dickson Chiu-2004

  4. WML – One Card Text is specified inside p element. A card can have none, one or several p elements. Element br indicates start of a new line. <?xml version="1.0"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"><wml><!-- THIS IS THE FIRST CARD IN THE DECK --><card id="start" title=“S.C. Cheung WAPSITE"><p>Welcome to MTMI515!!</p></card></wml> Dickson Chiu-2004

  5. WML – Font Style Text emphasis elements em, strong, b, i, u, big, small - meanings equivalent to HTML counterparts. <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <!-- THIS IS THE FIRST CARD IN THE DECK --> <card id="start" title="S.C. Cheung WAPSITE"> <p> <b>This is bold</b><br/> <i>This is Italic</i><br/> <u>This is Underline</u><br/> <big>This is Big text</big><br/> <small>Small Text</small><br/> <strong>This Is STRONG</strong> </p> </card> </wml> Dickson Chiu-2004

  6. WML – Two Cards Attributes id in card elements serve as anchor for intercard links. <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <!-- THIS IS THE FIRST CARD IN THE DECK --> <card id="start" title="S.C. Cheung WAPSITE"> <p>Next tutorial.<br/> <a href="#tutorial">Continue Tutorial</a> </p> </card> <!-- THIS IS THE SECOND CARD IN THE DECK --> <card id="tutorial" title="S.C. Cheung WAPSITE"> <p align="center">Welcome To part 2<br/> Here the tutorial continues </p> </card> </wml> Dickson Chiu-2004

  7. WML – Three Cards <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <!-- THIS IS THE FIRST CARD IN THE DECK --> <card id="start" title="S.C. Cheung WAPSITE"> <p align="center"> <big><u>Tutorials</u></big> </p> <p align="left"><small>Want to see a <a href="#joke">Joke</a>.</small></p> <p align="left"><small>Are how about a <a href="#pic">Picture</a>.</small></p> </card> Dickson Chiu-2004

  8. WML – Three Cards <!-- THIS IS THE SECOND CARD IN THE DECK --> <card id="joke" title="S.C. Cheung WAPSITE"> <p align="center">Joke's</p> <p><small>1. What do you get if you cross an owl with a skunk?<br/> A. bird that smells but doesn't give a hoot !!!!!!!!</small></p> <p><small>2.Why did the rooster cross the road?<br/> A. To prove he wasn't chicken !!</small></p> </card> <!-- THIS IS THE THIRD CARD IN THE DECK --> <card id="pic" title="S.C. Cheung WAPSITE"> <p align="center"><b>Picture</b></p> <p align="center"><img src="child3.wbmp" alt=" HI"/></p> </card> </wml> Dickson Chiu-2004

  9. WML - Table <card title="Table">  <p>   <table columns="3">    <tr>     <td>Cell 1</td>     <td>Cell 2</td>     <td>Cell 3</td>    </tr>   </table>  </p> </card></wml> Dickson Chiu-2004

  10. WML – Anchor Always has a task ("go", "prev", or "refresh") specified. The task defines what to do when the user selects the link. <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card title="Anchor Tag"> <p> <anchor>Next page <go href="demo_wap_text.wml"/> </anchor> </p> </card> </wml> Dickson Chiu-2004

  11. WML - Input <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card id="input1" title="Info"> <p> A: <input name="Name" size="15"/> B: <input name="Age" size="15" format="*N"/> C: <input name="Sex" size="15"/> </p> </card> </wml> Dickson Chiu-2004

  12. WML - Select <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card id="card1" title="Sections"> <p> <select name="name"> <option value="HTML">HTML Section</option> <option value="XML">XML Section</option> <option value="WAP">WAP Section</option> </select> </p> </card> </wml> <select multiple="true"> Dickson Chiu-2004

  13. WML - Refresh <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card> <p> <anchor> Refresh This Page <go href="#refresh"/> </anchor> </p> </card> </wml> <card id="refresh" title="S.C. Cheung WAPSITE"> <refresh/> </card> Dickson Chiu-2004

  14. WML - Timer <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card ontimer="2.wml"> <timer value="10"/> <p>Some Message</p> </card> </wml> Dickson Chiu-2004

  15. WML - Variables • Specify a variable with the Setvar command • <setvar name="i" value="500"/> • Specify a variable through an input element (like input, select, option, etc.) <card id="card1"> <select name=“opt"> <option value="HTML">HTML Tutorial</option> <option value="XML">XML Tutorial</option> </select> </card> • To use the variable we created in the example above: <card id="card2"> <p>You selected: $(opt)</p> </card> Dickson Chiu-2004

  16. WML - Posting to the Server <!-- From: http://www.topxml.com/wap/articles/wml_jsp/default.asp --> <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//PHONE.COM//DTD WML 1.1//EN" "http://www.phone.com/dtd/wml11.dtd"> <wml> <card id="start" title="Weather"> <do type="accept" label="Go!" > <go href="weather.jsp"><!-- submitted to a JSP --> <postfield name="query" value="$query" /> <postfield name="QP1" value="$QP1" /> <postfield name="target" value="wml-$(query)" /> </go> </do> <p align="center">Weather Page</p> <p> Zip? <input name="QP1" format="*N" maxlength="10" value="" /><br /> Query? <select name="query"> <option value="TimeTemp" > time &amp; temp </option> <option value="AllTable" > all fields </option> <option value="AllText" > all fields format</option> </select> </p> </card> </wml> Dickson Chiu-2004

  17. Generating WML with XSLT <!-- Available: http://kwchiu.dyndns.org:7999/xslt3.xsl --> <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <wml> <card> <table> <xsl:for-each select="/hsiComponents/component"> <tr> <td><xsl:value-of select="name"/></td> <td><xsl:value-of select="lastTrade"/></td> </tr> </xsl:for-each> </table> </card> </wml> </xsl:template> </xsl:stylesheet> <?xml version="1.0" encoding="UTF-8"?> <wml> <card> <table> <tr><td>CHEUNG KONG</td> <td>64.00</td></tr> </table> … </card></wml> <?xml version="1.0" encoding="UTF-8"?> <hsiComponents> <component> <name>CHEUNG KONG</name> <lastTrade>64.00</lastTrade> </component> ... </hsiComponents> Dickson Chiu-2004

  18. WAP Emulator • http://www.gelon.net/ • Paste URL to WAP emulator: • http://kwchiu.dyndns.org:7999/html2dom/result?sourceURL=http%3A%2F%2Ffinance.yahoo.com%2Fq%2Fcp%3Fs%3D%5EHSI&xslt1URL=http%3A%2F%2Fkwchiu.dyndns.org%3A7999%2Fxslt1.xsl&xslt2URL=http%3A%2F%2Fkwchiu.dyndns.org%3A7999%2Fxslt3.xsl&submit=convert • More sophisticated development: • http://www.forum.nokia.com/main/0,6566,034-521,00.html Dickson Chiu-2004

More Related