Much has been written about the impact that XML is having on business-to-business interactions as an enabling technology for the automated exchange of business documents. To be sure, that kind of information exchange is a killer application for XML technology that promises to dramatically lower the cost of entry for electronic commerce and level the playing field for small and medium-size enterprises-and thus worthy of all the hype it's getting.
However, XML is not just for business applications. XML is poised to solve some of the Web's biggest problems and it will affect the average person to a much higher degree than we realize. It is widely known that the Internet is a speed-of-light network that often moves at a crawl; and although nearly every kind of information is available online, it can be really difficult to find just the particular piece you're looking for. And, displaying your favorite Web page on your wireless PalmPilot or Web phone is difficult at best when you only have a two-inch display area to work with.
Those problems arise from the way HTML was designed. HTML describes how a Web page will be displayed on a browser, defining such things as fonts, color usage, page content layout and graphics. However, HTML has no concept of a structured piece of data embedded in a document, such as name, price or product description. Tags that instruct the browser how to display the page are mixed in with the data.
XML, on the other hand, does not specify formatting information or instruct a browser how to display information. Rather, it provides information on what the data structures are in the document. Because XML provides a structured approach to creating documents and is self-describing, new dynamics are popping up in the way that Web servers and browsers interact.
For example, imagine going to an online retailer that sells custom-configured computers. The Web server would typically start the process by sending an HTML page (or number of pages) to the browser displaying a list of available products and configuration options. You specify the base system and options that you are interested in and send the request back to the server. There the information is processed and sent back to your browser as a new Web page. Regardless of how minor your requested modifications were, it results in a request's being sent to a distant and probably overburdened Web server to be parsed, processed and returned as an entirely new page, graphics and all. You continue to iterate in this fashion until you finally get what you want. This can be a tedious and slow process, especially if you happen to be online during a heavy-use period.
However, if the original Web page had been sent in XML, then a small Java technology-based program could be sent along with the XML file that could be run on the client system to modify your configurations and generate price quotes on the fly. Sorts, modifications and calculations could be done in real-time on the client side without having to exchange any information with the Web server until your order was ready to be submitted.
The time savings, and the reduction in network traffic and Web-server overhead, can be significant using XML-based documents. Multiply this example by a few million Web users and the global efficiency gains become dramatic. As XML use spreads, the Web should become noticeably more responsive.
Searching for content on the Web can be a daunting experience. Using the above example, it is impossible today to do a Web search to generate a list of computers from multiple vendors that match specific configuration and pricing.
Again, because HTML is an unstructured document type, mixing data and display instructions, there's no way to do those kinds of searches easily and reliably. Because XML documents separate data from the display instructions, the data is directly exposed to search engines, eliminating the need to use complex algorithms to sift through formatting information to separate data from display instructions.
With XML, search engines will reach levels of efficiency, accuracy and functionality on Web searches that are almost inconceivable today. A Web search will become more like a Web query in the traditional database context. As more of the information and content on the Web is available in an XML format, it will become easier and faster to find exactly what you need. This suggests that a new generation of search engines will emerge that combine customizable business logic with search results to add value to the raw data or information generated by a search.
This is where the concept of a service-driven network becomes meaningful to the average person. In a service-driven network, companies or individuals could provide small, lightweight Java technology-based applications that perform those functions and log their availability in a public registry, allowing users to find them through some Web discovery mechanism.
Within a few years, the world will be populated with hundreds of millions of Web phones, PDAs, automotive accessories and other wireless devices for accessing the Web. The thing that all these devices have in common, and the challenge that it presents for Web access, is their small size. In order to save power and fit into a small form factor, the displays on these devices are very small, with screens on the order of one to two inches in diameter. Web pages that display just fine on a 17-inch desktop monitor just don't work for these small wireless devices.
XML provides the right technology to solve this problem. Since XML separates the actual data from the presentation of the data, a single XML document can be tailored to meet the presentation needs of any number of devices. This is done by using an XML specification called Extended Style Language (XSL). XSL style sheets define how a browser will render a given XML document. When a Web server gets a request for a Web page from a client, it can identify the type of device making the request and select the XSL style sheet appropriate for the device; rich content for a full-size monitor or a stripped-down and reformatted version for a Web phone.
Sun has developed some interesting technology for enabling the rapid generation of device-specific Web pages, called the XSLT Compiler. (A preview version can be downloaded from www.sun.com/xml.) Current XSL transformation engines, such as James Clark's XT engine, map an instance of a style sheet against the entire XSL specification in the process of doing a transformation. Since most transformations use only a small portion of the overall XSL specification, this approach is not very efficient. The XSLT compiler takes a different one, essentially compiling the style sheet into a compact set of XSL instructions, using only those that are applicable to the desired transformation and ignoring the rest. The style sheet is compiled as Java byte code, which Sun calls a translet.
The translet files are quite small-often less than 10 kbytes in size, compared with a typical size of 700 kbytes for traditional XSL engines. Translets will run on any device that supports Java, which is ideal for designing portable net-connected devices.