1.2. What's Important?
Once you've accepted that XML can help you out, the next question is what part of it you need. As I mentioned earlier, there are literally hundreds of applications of XML, and trying to find the right one is not an easy task. I've got to pick out twelve or thirteen key topics from these hundreds, and manage to make them all applicable to you; not an easy task! Fortunately, I've had a year to gather feedback from the first edition of this book, and have been working with XML in production applications for well over two years now. That means that I've at least got an idea of what's interesting and useful. When you boil all the various XML machinery down, you end up with just a few categories.
1.2.1. Low-Level APIs
An API is an application programming interface, and a low-level API is one that lets you deal directly with an XML document's content. In other words, there is little to no preprocessing, and you get raw XML content to work with. It is the most efficient way to deal with XML, and also the most powerful. At the same time, it requires the most knowledge about XML, and generally involves the most work to turn document content into something useful.
The two most common low-level APIs today are SAX, the Simple API for XML, and DOM, the Document Object Model. Additionally, JDOM (which is not an acronym, nor is it an extension of DOM) has gained a lot of momentum lately. All three of these are in some form of standardization (SAX as a de facto, DOM by the W3C, and JDOM by Sun), and are good bets to be long-lasting technologies. All three offer you access to an XML document, in differing forms, and let you do pretty much anything you want with the document. I'll spend quite a bit of time on these APIs, as they are the basis for everything else you'll do in XML. I've also devoted a chapter to JAXP, Sun's Java API for XML Processing, which provides a thin abstraction layer over SAX and DOM.
1.2.2. High-Level APIs
High-level APIs are the next step up the ladder. Instead of offering direct access to a document, they rely on low-level APIs to do that work for them. Additionally, these APIs present the document in a different form, either more user-friendly, or modeled in a certain way, or in some form other than a basic XML document structure. While these APIs are often easier to use and quicker to develop with, you may pay an additional processing cost while your data is converted to a different format. Also, you'll need to spend some time learning the API, most likely in addition to some lower-level APIs.
In this book, the main example of a high-level API is XML data binding. Data binding allows for taking an XML document and providing that document as a Java object. Not a tree-based object, mind you, but a custom Java object. If you had elements named "person" and "firstName", you would get an object with methods like getPerson( ) and setFirstName( ). Obviously, this is a simple way to quickly get going with XML; hardly any in-depth knowledge is required! However, you can't easily change the structure of the document (like making that "person" element become an "employee" element), so data binding is suited for only certain applications. You can find out all about data binding in Chapter 14, "Content Syndication".
1.2.3. XML-Based Applications
In addition to APIs built specifically for working with a document or its content, there are a number of applications built on XML. These applications use XML directly or indirectly, but are focused on a specific business process, like displaying stylized web content or communicating between applications. These are all examples of XML-based applications that use XML as a part of their core behavior. Some require extensive XML knowledge, some require none; but all belong in discussions about Java and XML. I've picked out the most popular and useful to discuss here.
First, I'll cover web publishing frameworks, which are used to take XML and format them as HTML, WML (Wireless Markup Language), or as binary formats like Adobe's PDF (Portable Document Format). These frameworks are typically used to serve clients complex, highly customized web applications. Next, I'll look at XML-RPC, which provides an XML variant on remote procedure calls. This is the beginning of a complete suite of tools for application communication. Building on XML-RPC, I'll describe SOAP, the Simple Object Access Protocol, and how it expands upon what XML-RPC provides. Then you'll get to see the emerging players in the web services field by examining UDDI (Universal Discovery, Description, and Integration) and WSDL (Web Services Descriptor Language) in a business-to-business chapter. Putting all these tools in your toolbox will make you formidable not only in XML, but in any enterprise application environment.
And finally, in the last chapter I'll gaze into my crystal ball and point out what appears to be gathering strength in the coming months and years, and try and give you a heads-up on what is worth monitoring. This should keep you ahead of the curve, which is where any good developer should be.
Copyright © 2002 O'Reilly & Associates. All rights reserved.