Webmaster''''s Guide to the Wireless Internet part 11 doc

10 242 0
Webmaster''''s Guide to the Wireless Internet part 11 doc

Đang tải... (xem toàn văn)

Thông tin tài liệu

159_wg_wi_02 10/22/01 4:32 PM Page 72 A New Markup: WML Solutions in this chapter: ■ A Brief History of Wireless Content ■ WML Overview ■ WML Elements ■ Creating WML Content ■ WML Editors, WAP SDKs, and Emulators  Summary  Solutions Fast Track  Frequently Asked Questions Chapter 3 73 159_wg_wi_03 10/22/01 4:33 PM Page 73 74 Chapter 3 • A New Markup: WML Introduction Telecommunications technology has arrived at the point where we can now access information on the Internet through a mobile cellular device.Wireless Markup Language (WML) is a lightweight markup language specifically created to address the limitations of wireless devices and the rigors placed on the transmission of con- tent over the air through cellular networks.This chapter presents an overview of the core basics necessary to understand the WML markup language. Once you have the basics under your belt, you can go on to take a concise yet thorough examina- tion of the various elements that make up the WML language. With a thorough understanding of the WML language, you will then take a look at the various approaches you can take to create WML sites that will really shine.The chapter provides an overview of the many software development kits (SDKs),WML editors, and emulators that are available to aid you in the construc- tion of WML sites. A Brief History of Wireless Content The wireless transmission of data occurred longer ago than one may think. Our ancestors were using sound to transmit primitive coded signals between villages thousands of years ago, transmitting information without any apparent physical connection between source and receiver; and the pioneering work of inventors such as Samuel Morse and Charles Babbage in the 19th and 20th century laid the foundations for the massive worldwide cellular networks we now enjoy. Similarly, there is more than meets the eye when examining the Wireless Application Protocol (WAP) and specifically, the WML that WAP specifies, because WML has its historical roots in the development of several separate offerings from different vendors. Developing the Intelligent Terminal Transfer Protocol The Intelligent Terminal Transfer Protocol (ITTP) was developed by Ericsson in 1995 with the specific aim of allowing network operators to provide enhanced wireless services to their subscribers. ITTP essentially handles the communication between the network-based application and an appropriately equipped mobile phone, however, its limitation is that such services are specific to the network implementing them. www.syngress.com 159_wg_wi_03 10/22/01 4:33 PM Page 74 www.syngress.com Developing the Handheld Device Markup Language The Hypertext Markup Language (HTML) necessitates a clear visual and struc- tural reference with which to successfully render content within Web browsers. Much of HTML is unnecessary to users of wireless devices, and with the band- width overhead present in current cellular networks, developing wireless content with just HTML doesn’t make sense. Much of the HTML would be unnecessary or even useless to the end device.This problem was very much in the minds of Unwired Planet, which in mid-1996 developed the Handheld Device Markup Language (HDML) and made it available to developers. HDML is a lightweight language designed to allow specially equipped “thin- client” wireless devices to access Internet-based content using the underlying World Wide Web transports and protocols. Unwired Planet submitted their pro- posal for HDML to the World Wide Web Consortium (W3C) in April 1997.The specification currently stands at version 3.0 and is used extensively in wireless devices in the United States.Although the Extensible Markup Language (XML) had become available around the same time that Unwired Planet submitted HDML to the W3C, at that time the huge potential of XML had yet to be real- ized, and it was passed over by Unwired Planet as a means of representing wire- less content. Developing the Tagged Text Markup Language The Tagged Text Markup Language (TTML) was developed by Nokia Corporation as part of its Smart Messaging solution to solve the same problem that Unwired Planet was seeking to address with HDML: accessing Internet- based content from a wireless device. The Nokia Artus NetGate, (known in the US as the Nokia TTML Gateway) allowed filtered content to be harvested from existing sites and sent to the user’s device as a Short Message Service (SMS).The Artus NetGate gateway and an accompanying NetGate compatible phone (the 8110i for enhanced browsing) were announced in March 1997. Forming the WAP Forum In 1997, the US network operator Omnipoint Communications asked Nokia and Unwired Planet to apply for the contract to provide wireless content services to Omnipoint. Omnipoint did not want to have to deal with the proprietary A New Markup: WML • Chapter 3 75 159_wg_wi_03 10/22/01 4:33 PM Page 75 76 Chapter 3 • A New Markup: WML solutions that vendors such as Nokia (with Smart Messaging) and Unwired Planet (with HDML) proposed and requested that they work together to provide a single solution. In June 1997, Nokia and Unwired Planet formed the WAP Forum in response to Omnipoint’s request, also bringing together Motorola and Ericsson.These initial founders represented over 90 percent of the wireless market.The aim was to develop a protocol that could be built on any platform to allow users to interact with services and information as fast and efficiently as pos- sible.Where HDML dealt with structuring and presenting data to the user,WAP defines a whole series of specifications that deal with every aspect of Internet- based wireless communications, including the language used to describe wireless content.WAP essentially took all that was best from ITTP, HDML, and TTML and combined them in a single series of protocols (with many improvements along the way) to form a single network-independent technology that could be utilized from any appropriately equipped devices. Combining Languages into the Wireless Markup Language The WAP Forum examined the various markup languages being offered by the different companies and took the best aspects of each to form the Wireless Markup Language.WML was released by the WAP Forum in 1999 and proved an immediate success—all the handset manufacturers quickly adopted it.Those devices that contained HDML browsers also gained the capability to browse WML content from HDML version 3.1 onwards. As was noted earlier, when HDML was created, XML was not thought to be a proven technology. However, with the subsequent runaway success of XML, it was obvious that WML would serve developers’ needs best if it was formulated as an application of XML. At first glance, a WML file looks quite similar to an HTML file.WML uses brackets (< and >) to enclose elements, and the elements have attributes just as HTML does. However, this is where the similarity ends.WML is purely con- cerned with the structuring of data. It does not specify how the elements should appear on-screen—this is left to the browser, which will render the WML as it sees fit.This was a deliberate move on the part of the WAP Forum, and though sometimes criticized for being too unstructured, it has allowed WML to be used in everything from mobile phones with a tiny two-line display to more sophisti- cated “Smart Phone” devices such as the Ericsson M280. www.syngress.com 159_wg_wi_03 10/22/01 4:33 PM Page 76 A New Markup: WML • Chapter 3 77 WML offers many improvements over HDML, which this chapter covers later when it looks at the specifics of the language.The most important change is that WML, as an application of XML, must abide by the rules that govern the creation of XML documents. Projecting Future Growth As with so many Internet standards and technologies, evolution of wireless stan- dards continues at incredible speed. Nippon Telegraph and Telephone (NTT) DoCoMo’s i-mode service, a well documented runaway success in Japan, delivers a highly popular service to its subscribers using a subset of the HTML language called compact HTML (cHTML). Roughly equivalent to HTML 3.2 and requiring no extra server software over and above that used for hosting Web sites, developers have been able to supply content without the need to learn complex new protocols. With such popularity, it might seem safe to say that WAP’s days could well be numbered, but this is not so.WAP is a continuously evolving specification and (in line with the continuing development of HTML) is set to embrace XHTML Basic and Cascading Style Sheets (CSS), though WML will continue to be sup- ported. NTT DoCoMo also has indicated it is likely to support XHTML in the future and will thus fall in line with the WAP Forum in ensuring that future developments are as interoperable as possible and will provide a firm mutual base to expand upon. Commenting on the invention of the telephone in 1876,Western Union said “This ‘telephone’ has too many shortcomings to be seriously considered as a means of communication.”Who could have predicted that the humble telephone would throw off its wire shackles and empower people to receive personal calls from across the globe? WML Overview When HTML was first conceived, it was primarily meant to be a way of struc- turing data so that its creator,Tim Berners-Lee, could more easily find the con- tent he needed.As HTML progressed from version to version, the limitations of a structural markup language became so frustrating that the now near-legendary Netscape and Microsoft HTML extensions were added, allowing the HTML authors to specify what sort of fonts were to be used, in what color, and so on. HTML, together with Cascading Style Sheets (CSS), companion scripting lan- guages, and a whole plethora of XML-based languages is now a very different www.syngress.com 159_wg_wi_03 10/22/01 4:33 PM Page 77 78 Chapter 3 • A New Markup: WML beast. However, its development into the mature form it takes today has much to do with a return to using HTML for what it was meant to do—structure con- tent. Similarly,WML seeks to provide structure (and therefore meaning) to con- tent.As mentioned earlier, the use of tags and attributes shows a similarity with HTML, but this is a language that was developed from the ground up for use on wireless devices, an environment which has many limitations concerning what content can be easily viewed.WML has no corresponding CSS style sheet to tell a device how the content should be formatted—that is left up to the device.This was intentional, because many types of different devices would be making use of WML, from personal communicators to appliances.The biggest difference between WML and HTML is that WML is also an application of XML, bringing new considerations that we examine in the following sections. The most important issues that affect how you will approach the creation of WML documents is that WML as an application of XML is a strictly interpreted language.A document is a WML document if it is both well-formed and valid. Additionally,WML must meet certain further constraints, which we examine later in the chapter. Creating Well-Formed Documents A WML document contains elements that have a start element and an end element.If the element isn’t a container for data, then the element must be self-closing.This may seem somewhat confusing, so let’s take a look at an example partial docu- ment (don’t worry about what everything means, we take a look at that later). <wml> <card> <p>I like Ice-cream.<br/>Do you?</p> <card> </wml> As you can see, the code has four elements: <wml>, <card>, <p>, and <br>. The <wml>, <card>, and <p> elements are container elements and as such have corresponding closing tags.The <br> element, however, is empty—it doesn’t contain any data, and thus is self-closing, which is indicated by the backslash. Nesting WML documents must be well-formed. This intimidating statement simply means that a document’s elements must match.WML is constructed hierarchically, as www.syngress.com 159_wg_wi_03 10/22/01 4:33 PM Page 78 A New Markup: WML • Chapter 3 79 shown in the example in the preceding section.The opening element that occu- pies the same position in the hierarchy must correspond to the closing element at the same level.The following example shows an example of a document that is not well-formed: <wml> <card> <p>I like Ice-cream.<br/>Do you?<card> </p> </wml> Here, the <card> element has been closed before the <p> element.This is an example of invalid nesting. In addition to being properly nested, the elements must be closed, as detailed in the specification. Consider the following example: <wml> <card> <p>I like Ice-cream.<br/>Do you? <card> </wml> The closing element for the <p> element has been left out, which would result in the document not being well-formed.With the code nested and all elements closed, we have a well-formed piece of WML: <wml> <card> <p>I like Ice-cream.<br/>Do you?</p> <card> </wml> Nesting of elements should come easily to all those who have been practicing good HTML. However, due to the very forgiving nature of HTML, a lot of developers could be in for a big surprise, so it will stand you in good stead to get into the habit of nesting and closing elements properly, not only in WML but in HTML as well. Creating Valid Documents In addition to being well-formed, a WML document must be valid.Validity is achieved by the inclusion of a Document Type Definition (DTD).The DTD www.syngress.com 159_wg_wi_03 10/22/01 4:33 PM Page 79 80 Chapter 3 • A New Markup: WML describes the elements that may legally exist within the WML document and ensures that for the document to display, the WML document contains only those elements allowed by the DTD. To make our previous well-formed example valid we must add the appropriate XML declaration and the reference to the DTD: <?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>I like Ice-cream.<br/>Do you?</p> </card> </wml> This example is both well-formed and valid.The following document, although it is well-formed, is not valid: <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "//WAPFORUM//DTD_WML_1.1//EN" http://www.wapforum.org/DTD/wml_1.1.xml> <wml> <card> <para>I like Ice-cream.<br/>Do you?</para> </card> </wml> WARNING Although the various SDK emulators are excellent for providing in-depth information on the interactions that take place during the loading and execution of WML content, the actual end-device will very likely react dif- ferently upon encountering an error; it will also almost certainly provide precious little (if any) information on what went wrong. Do not rely 100 percent on emulators to test your content. www.syngress.com 159_wg_wi_03 10/22/01 4:33 PM Page 80 A New Markup: WML • Chapter 3 81 At first glance, everything may look all right, but <para> is an element that is not defined in the DTD; therefore, the WML is not valid and will cause an error on any device that tries to display it. Figure 3.1 shows how well-formed and valid WML displays; Figure 3.2 shows how incorrectly formed WML will generate an error. This example was created using the Openwave UP.SDK emulator, which includes a handy screen that provides more information in the event of an error. By referring to the information screen we can see exactly where we went wrong. www.syngress.com Figure 3.1 Well-Formed and Valid WML Figure 3.2 The SDK Catches an Error 159_wg_wi_03 10/22/01 4:33 PM Page 81 . Languages into the Wireless Markup Language The WAP Forum examined the various markup languages being offered by the different companies and took the best aspects of each to form the Wireless Markup. they work together to provide a single solution. In June 1997, Nokia and Unwired Planet formed the WAP Forum in response to Omnipoint’s request, also bringing together Motorola and Ericsson.These. within the WML document and ensures that for the document to display, the WML document contains only those elements allowed by the DTD. To make our previous well-formed example valid we must add the

Ngày đăng: 04/07/2014, 02:20

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan