- Is XML for documents or for data?
- A wide spectrum of application opportunities
- Opposites are attracted
- MOM and POP – They're so great together!
- Conclusion
3.2 A wide spectrum of application opportunities
Sorry about that, we've been reading too many marketing brochures. But it's true, nevertheless.
At one end of the spectrum we have the grand old man of generalized markup, POP People-Oriented Publishing. You can see him in Figure 3-2.
Figure 3-2 POP application.
At the other end of the spectrum is that darling of the data processors, MOM Machine-Oriented Messaging. She smiles radiantly from Figure 3-3.
Figure 3-3 MOM application.
Let's take a closer look at both of them.
3.2.1 People-oriented publishing
POP was the original killer app for SGML, XML's parent, because it saves so much money for enterprises with Web-sized document collections.
POP documents are chiefly written by humans for other humans to read.
Instead of creating formatted renditions, as in word processors or desk-top publishing programs, XML POP users create unformatted abstractions. That means the document file captures what is in the document, but not how it is supposed to look.
To get the desired look, the POP user creates a stylesheet, a set of commands that tell a program how to format (and/or otherwise process) the document. The power of XML in this regard is that you don't need to choose just one look you can have a separate stylesheet for every purpose.2 At a minimum, you might want one for print, one for CD-ROM, and another for a website.
POP documents tend to be (but needn't be) long-lived, large, and with complex structures. When delivered in electronic media, they may be interactive. How they will be rendered is of great importance, but, because XML is used, the rendition information can be and is kept distinct from the abstract data.
3.2.2 Machine-oriented messaging
MOM is the killer appæactually, a technology that drives lots of killer appsæfor XML on the Web.
The software that processes the messages is called middleware.3 As you might suspect from the name, it is software that comes between two other programs. It acts like your interpreter/guide might if you were to visit someplace where you couldn't speak the language and had no idea of the local customs. It talks in the native tongue, using the native customs, and translates the native replies the messages into your language.
MOM documents are chiefly generated by programs for other programs to read.
Instead of writing specialized programs (clients) to access particular databases or other data sources (servers), XML MOM users break the old two-tier client/server model. They introduce a third tier, the "middle tier", that acts as a data integrator. The middle-tier server does all the talking to the data sources and sends their messages to the client as XML documents.
That means the client can read data from anywhere, but only has to understand data that is in XML documents. The XML markup provides the metadata information about the data that was in the original data source schema, like the database table name and field names (also called "cell" or "column" names).
The MOM user typically doesn't care much about rendition. He does care, though, about extracting the original data accurately and making some use of the metadata. His client software, instead of having a specialized module for each data source, has a single "XML parser" module. The parser is the program that separates the markup from the data, just as it does in POP applications.
And just like POP applications, there can be a stylesheet, a set of commands that tell a program how to process the document. It may not look much like a POP stylesheet it might look more like a script or program but it performs the same function. And, as with POP stylesheets, there can be different MOM stylesheets for different document types, or to do different things with message documents of a single document type.
There is an extra benefit to XML three-tier MOM applications in a networked environment. For many applications, the middle-tier server can collect all of the relevant data at once and send it in a single document to the client. Further querying, sorting, and other processing can then take place solely on the client system. That not only cuts down Web traffic and overhead, but it vastly improves the end-user's perceived performance and his satisfaction with the experience.
MOM documents tend to be (but needn't be) short-lived, non-interactive, small, and with simple structures.