You can also display images in WMF, but there's a catch. Images must be in special WBMP format, and that format doesn't exactly permit the rich depth of colors you may be used to. In fact, WBMP format is black and white with no grayscalejust 1 bit per pixel. Here are some WBMP resources available online:
To display images, you probably won't be surprised to learn that WML has an <img> element. You set the alt , src , width , and height attributes of this element to display images; here's an example: Listing ch20_19.wml<?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 2.0//EN" "http://www.wapforum.org/dtd/wml20.dtd" > <wml> <card id="Card1" title="Images"> <p align="center"><b>Images</b></p> <p align="center"> <img alt="WML Image" src="ch20_20.wbmp" width="217" height="164"/> </p> </card> </wml> You can see this WML document, along with a WBMP image I created for it to display, ch20_20.wbmp, in Figure 20-18. Figure 20-18. Displaying an image.
That's it for our exploration of WMLand XML. We've come far in this book, from the very beginning up through valid and well- formed documents, DTDs, schemas, how to parse XML with JavaScript, data binding, CSS, XML and Java, DOM and SAX parsers, XSL transformations, XSL formatting objects, XLinks, XPointers, XHTML, RDF, SOAP, VML, and now WML and XML with JSP, ASP, Java servlets, and Perl. All that remains now is for you is to put all this incredible amount of technology to work for yourself. |