转载一篇有关转换HTML到WML的文章
来源:互联网 发布:工商局网络合同监管 编辑:程序博客网 时间:2024/06/02 09:07
我只在这里转了开头和结尾,感兴趣的朋友可以参看底部给出的URL.
What is WAP?
WAP is the Wireless Application Protocol. It is based on familiar Internet technologies, and was developed to deliver web content and services to wireless clients, such as mobile phones. Since, at present, such devices have severe memory, power, and bandwidth restrictions, web pages are formatted using WML (the Wireless Markup Language). It is an application of XML that is much like a restricted version of HTML. Further, there are special WAP servers that compile WML into byte code before sending the page to the device, thereby reducing the page size. However, WML can still be served "straight up" from any web server.
Introduction to converting HTML to WML
Recently (meaning around March of 2000), the TopXML mailing list had a discussion thread about WML, or the Wireless Markup Language. Someone asked about developing for WML, and I replied that I had done a little playing around with this. Many months prior I had put together a test web page that would take a URL as a query string parameter, fetch the document, convert it to WML, and return the converted document with a WML MIME type. The idea was to allow a WAP-phone user to be able to view any HTML page on the Internet, not just those specifically formatted in WML. For example, if you wanted to see the “XML Hack” home page (www.xmlhack.com), you would, from your WAP phone, go to a WML page that presented a simple form. The desired URL would be entered, and the form submitted. The web server would receive the submission, fetch the requested page, convert it to WML, and send back the results.
The owners of the TopXML web site asked me if I would consider writing an article about this, and I agreed. The only problem, though, was the code I wrote was in Perl, and ran on an Apache web server. Further, it did not use any XSL. The transformation from HTML to WML was done using string replacement and regular expressions; at the time, there was no decent XSLT Perl module. Still, the concepts would apply to any platform, and I though that building a similar app for IIS using VB would be interesting.
The problem breaks down into a set of tasks(steps):
- Provide a WML page where a user can enter a URL into a form field
- Receive the web page form request
- Pull out the desired URL from the query string
- Fetch the desired page
- Convert it to well-formed XML (e.g. XHTML)
- Transform the XML into WML
- Write the new document back to the WAP device
...........
Summary
We’ve seen an IIS/ASP/VB implementation of a site that allows a WAP device user to request any HTML page on the Internet and have it sent back as WML. There are a number of problems with the specific code: The object used to fetch web pages from the server may not work under all circumstance; the clean-up of HTML is done using a single-threaded command-line executable; the XSLT for transforming the HTML to WML is incomplete. However, these problems are isolated in dynamically loaded objects, so further enhancement can go on with any disruption to the main code. I would suggest that, if anybody finds this code useful, they take the time to create a more robust version making heavy use of it. This would include reconsidering the interface classes and the methods they define. Expanding the code is much easier if it permits polymorphism; off hand, I can think of a few more methods that the ISimpleHTTP.IRequest interface could define, such as a method for setting POST data, or methods for adding additional headers.
原文出处 TOPXML: http://www.topxml.com/wap/html2wap.asp
- 转载一篇有关转换HTML到WML的文章
- 转载的一篇有关gdb的不错的文章
- 转载:有关京东和刘强东的一篇文章
- 最近看到一篇有关性能分析各个参数的的文章还好就转载分享了,希望以后能用到!
- 将wml转换成html的方法。
- 转载的一篇文章
- 转载的一篇文章
- 转载:一篇关于CString类型转换的文章
- [文章]有关char指针的文章一篇
- 转载 有关DDR的文章
- 转载一篇不错的文章
- 转载别人的一篇文章
- 转载的一篇sqlserver文章
- 转载一篇ClickOnce的文章!
- 转载一篇STL的文章
- 转载一篇很好的文章
- (转载)一篇有趣的文章
- 转载一篇ClickOnce的文章!
- back
- 云计算泄露Google的秘密
- 利用Java生成静态HMTL页面的方法收集
- 优化字符串操作
- vba利用treeview算距离
- 转载一篇有关转换HTML到WML的文章
- 如何结合使用 Subversion 和 Eclipse
- 提前书释意
- 修改了[HTML字符查看小工具],练练手,学学JS
- 使用PL/SQL,如何获得数字的英文拼写呢?
- SOA鼻祖 Eric Newcomer谈SOA
- 圣经基本真道
- 裸奔编程之使用Servlet实现REST风格 单纯使用Servlet进行完成REST解析
- 美丽景色