- 30 -
through more examples of applications of XML.
XML—Changing the Nature of Documents
In
Chapter 1
, we briefly mentioned how XML changes our basic concept of what a
document is. Now’s the time to go into more detail about this.
Ever since human beings began recording information, we’ve been forced to create
records that were independent, cohesive entities that were entirely self-describing—
content, data, and structure are all thought of as being melded into a single document.
Cave dwellers painted images in caves that recorded the story of the hunt. In this case,
the cave wall itself was the document. The medium was the cave wall, the content
consisted
of the actual characters, and each author defined his or her format
independently.
As we made the move to papyrus, paper, the codex, the printing press, and recently,
electronic word processing, we’ve tried to keep all facets of information (content and
format) together,
in complete packages, that is, in complete documents.
When we made the move to electronic media, we continued this philosophy. Today’s
word processors are reflections of the paper printing industry and require you to
concentrate on the content, format, and structure of the document all at the same time.
Some would argue that in the good old days when all we had was text editors, report
writing hardly took any time. If you don’t believe this, ask yourself how much time you
spend writing an e-mail update versus the time you spend writing a
proper memo that
does the same. Transmission time aside, when you write the e-mail update, you don’t
spend a lot of time worrying about spelling or grammar mistakes. All you care about is
getting your point through. Once written, a spell checker checks spellings in a batch
process and—poof—your e-mail is sent to its destination.
When you write the memo, you invariably spend time worrying about formatting and
spelling and grammar checking
of your document
as you write it
. This cumulative, all-at-
once approach, though seemingly powerful, inevitably slows you down. Sure, we humans
are multiprocessing entities—there’s no denying that—but when it comes to outputting
your thoughts, sometimes it is better to get everything that’s
in your mind out before you
start worrying about what it looks like. Certainly this is arguable, and a strong case can
be made either way, but a common theme emerges: Breaking things into more
manageable chunks is a smarter way of doing things. Cognitive science tends to suggest
the same thing.
Breaking documents into more manageable chunks that can be processed separately
and more efficiently is what XML is all about. In an XML document,
a document can go
through several stages of processing by different processors. For example, if we treated
this book with an XML approach the following steps would occur:
•
As authors, we would worry about writing meaningful and accurate content.
•
Our editors would ensure that the content is grammatically correct.
•
Layout experts would focus on making sure that the document is stylistically
appealing.
•
Publishing experts would focus on ensuring the document is printed correctly.
•
Marketing experts would make sure that the book is marketed properly.
•
Distribution experts would focus on making sure that the book is distributed to the right
retailers.
- 31 -
•
Retailers would focus on placing the book in the right spot so it sells.
But wait a minute! That’s exactly how this book is being treated in any case! Now you’ve
picked it up: an XML approach mimics the real world better. XML ensures that the data
being exchanged between each pair of processors is in a common language so that
everyone can focus on what they have best.
In XML, the document is broken into three generic parts:
•
Content
•
Structure
•
Format
We talk about how you can create and work with these separate parts throughout this
book.