[jdom-interest] Philosophical XML (was API Inertia)

Elliotte Rusty Harold elharo at metalab.unc.edu
Wed May 2 06:58:07 PDT 2001

At 8:04 PM -0400 5/1/01, Paul Philion wrote:
>In my mind, XML is very simple: It is a tree of elements; elements that
>contain other elements and elements that contain text.

Unfortunately XML is more complicated than this. Your mental model 
ignores mixed content. How does it handle this common case?

   This is a sentence with one really important
   in the middle.

The P element contains text AND it contains a child element. In 
essence the P element contains two text nodes and one element node. 
The text nodes cannot be reasonably represented as child elements.

Forgetting this is a very common mistake of people coming to XML from 
database and programming communities as opposed to the document 
communities where mixed content is much more common. I regret that I 
made and even encouraged this mistaken thinking in my first two books 
about XML. On the other hand, by the time I wrote XML in a Nutshell 
I'd realized the errors of my ways, and explaining the difference 
between narrative-centric and data-centric documents became a major 
focus of that book.

JDOM must be able to support XML 1.0 in its full complexity. We 
cannot limit the API to only documents without any mixed content.

| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
|                  The XML Bible (IDG Books, 1999)                   |
|              http://metalab.unc.edu/xml/books/bible/               |
|   http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/   |
|  Read Cafe au Lait for Java News:  http://metalab.unc.edu/javafaq/ |
|  Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/     |

More information about the jdom-interest mailing list