home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeHTML & XHTML: The Definitive GuideSearch this book

15.8. Using XML

Our address example is trivial. It hardly scratches the surface of the wide range of applications that XML is suited for. To whet your appetite, here are some common uses for XML that you will certainly be seeing now and in the future.

15.8.1. Creating Your Own Markup Language

We touched on this earlier when we mentioned that the latest versions of HTML are being reformulated as compliant XML DTDs. We cover the impact XML has on HTML in the next chapter.

But even more significantly, XML enables communities of users to create languages that best capture their unique data and ideas. Mathematicians, chemists, musicians, and professionals from hundreds of other disciplines can create special tags that represent unique concepts in a standardized way. Even if no browser exists that can accurately render these new tags in a displayable form, the ability to capture and standardize information is tremendously important for future extraction and interpretation of these ideas.

For more mainstream XML applications with established audiences, it is easy to envision custom browsers being created to appropriately display the new information. Smaller applications or markets may have more of a challenge creating markup languages that enjoy such wide acceptance. Creating the custom display tool for a markup language is difficult; delivering that tool for multiple platforms is expensive. As we've noted, some of these display concerns can be mitigated by appropriate use of style sheets. Luckily, XML's capabilities extend beyond document display.

15.8.2. Document Exchange

Because XML grew out of the tremendous success of HTML, many people think of XML as yet another document display tool. In fact, the real power of XML lies not in the document display arena, but in the world of data capture and exchange.

Despite the billions of computers deployed worldwide, sharing data is as tedious and error-prone as ever. Competing applications do not operate from common document storage formats, so sending a single document to a number of recipients is fraught with peril. Even when vendors attempt to create an interchange format, it still tends to be proprietary and is often viewed as a competitive advantage for participating vendors. There is little incentive for vendors to release application code for the purpose of creating easy document-exchange tools.

XML avoids these problems. It is platform-neutral, generic and can perform almost any data capture task. It is equally available to all vendors and can be easily integrated into most applications. The stabilization of the XML standard and the increasing availability of XML authoring and parsing tools is making it easier and easier to create XML markup languages for document capture and exchange.

Most importantly, document exchange rarely requires document presentation, thus eliminating "display difficulties" from the equation. Often, an existing application will use XML to include data from another source, and then use its own internal display capabilities to present the data to the end user. The cost of adding XML-based data exchange to existing applications is relatively small.

15.8.3. Connecting Systems

A level below applications, there is also a need for systems to exchange data. As business-to-business communication increases, this need grows even faster. In the past, this meant that someone had to design a protocol to encode and exchange the data. With XML, exchanging data is as easy as defining a DTD and integrating the parser into your existing applications.

The data sets exchanged could in fact be quite small. Imagine shopping for a new PC on the Web. If you could capture your system requirements as a small document using an XML DTD, you could send that spec to a hundred different vendors to quote you a system. If you extend that model to include almost anything you can shop for -- from cars to hot tubs -- XML provides an elegant base layer of communication among cooperating vendors on the Internet.

Almost any data that is now captured and stored can be more easily shared using XML. For many systems, the XML DTDs will define a data transfer protocol and nothing more. The data may never actually be stored using the XML-defined markup; it may exist in an XML-compatible form only long enough to pass on the wire between two systems.

In conjunction with XML-based data exchange, the Extensible Stylesheet Language, or XSL, will be increasingly used to describe the appearance and definition of the data represented by these XML DTDs. Much like Cascading Style Sheets and their ability to transform HTML documents, XSL will support the creation of style sheets for any XML DTD. CSS can be used with XML documents as well, but it is not as programmatically rich as XSL. While CSS stops with style sheets, XSL is a style language. XSL certainly addresses the need for data display, and it also provides rich tools that allow data represented with one DTD to be transformed into another DTD in a controlled and deterministic fashion. A complete discussion of XSL is beyond the scope of this book; consult an appropriate O'Reilly reference for complete details.

The potential for XML goes well beyond that of traditional markup and presentation tools. What we now see and use in the XML world is only scratching the surface of the potential for this technology.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.