XML makes modeling information in terms of a component/sub-component
model of the world very straightforward. XML tags (or element types to
be precise) are essentially containership modeling devices with the
powerful ability to express containership, not only of information
content but also of other containers. These containers can contain
other containers and so on.
One of the slightly mind-bending things about this containership model
is that containers can contain other containers that are "the same"
type of container. This so called recursive content capability is
second nature to those who naturally think in terms of documents (i.e.,
put a table inside another table) but less so to those who naturally
think in terms of databases (i.e., put an invoice inside another
invoice).
As a thought experiment, pretend that tags did not have associated
element type names. Fuzz your mental vision to the point where all you
see is the "things within things" containership structure created by
the "<>" and "</>" shells that are left behind. Notice in your minds
eye that when the tag names are stripped off like this, every level in
the structure looks much like any other level.
"Well duh", is one possible response to this observation. Of course
each level of the structure looks like every other level when the names
of the tags are removed!
I find looking at a tag structure without the tag names visible a
humbling experience that is good for the soul. It shows in stark relief
the futility of the boundaries we create in data modeling. We create a
boundary whenever we split a universe of information into chunks we
call "documents" which we then aggregate together into collections of
documents. Prior to tagging any information into XML we need to decide
where the concept of document stops and the concept of document
collection starts.
The trouble is, there is no correct place to put such a boundary.
Turning off the tag names in an XML document view shows this up nicely.
What is a document anyway? Boy, there is a subject for a never-ending
debate! Lets say we agree that a document is a cohesive collection of
chunks of stuff. Ok, but what is a chunk? A cohesive collection of
chunks of other stuff...and so on it goes all the way down to
individual characters.
At least in the downward direction we reach a point where we cannot
split any more. Not so on the way up! At an SGML conference many years
ago I remember hearing about an SGML document that was over 2 gigabytes
in size. At the time I thought, "Wow"; nowadays, I think a 2 gigabyte
XML/SGML file is actually pretty meaningless as a measure; it is just
the result of a fairly arbitrary decision as to how far up from
individual characters the concept of "document" should go.
Lets take an extreme example. If all the information content of the
U.S. Library of Congress were available in XML form, then where would
the modeling boundaries lay? Storage efficiency issues aside, what
would the fundamental document level of the model be? How about a
LibraryOFCongress tag topping and tailing one enormous XML document?
Maybe a Department tag creating a few thousand documents? A Book tag
thus creating millions of documents? A section tag creating a bazillion
documents? A paragraph? A sentence? A word? A character?
Does It Matter?
Fact is, it doesn't matter. Information is self-similar, all the way up
and all the way down. The decision is based not on concerns to do with
accurate modeling of the information but on physical limitations in the
real world (e.g., database and file system limitations).
Knowing that the quest for the perfect boundary between document and
document collection is an important step on the road to enlightenment
and will calm your soul. The document/collection decision is important
and has far reaching consequences for cross-referencing and information
reuse but there is no correct answer.
Information has a self-similar structure that extends from the shadow
at the back of Plato's Cave right through to the individual Unicode
code points constituting the atoms of the information universe. All we
can do is pound the pinions into the cave wall and hope the suction is
strong enough to carry us through.