[jdom-interest] The JDOM Model, Chapter 15 of Processing XML
with Java
Elliotte Rusty Harold
elharo at metalab.unc.edu
Tue May 7 08:13:01 PDT 2002
At 10:57 AM -0400 5/7/02, Alex Rosen wrote:
>Wow, this is a very insightful post. I agree completely: DOM is an XML
>weenie's view of an XML API, while JDOM is a Java developer's view of how
>XML would look without some of its ugly blemishes. DOM's job was just to
>model XML directly, warts and all. JDOM tried to make it simpler, more
>elegant, and more pleasurable to use. The mess is that there are some things
>that simplify your life 95% of the time, but limit you 5% of the time. JDOM
>was made for the "I just want to read some XML dammit, why does it have to
>be so hard?" case. The recent discussion about the DOCTYPE location is an
>example. Most of the time you don't care where exactly the DOCTYPE is
>located, and thinking of it as a property of the Document and not mixed in
>with the content is much simpler. But 5% of the time you do care, and we
>lose this information. The question is, is it worth it to make JDOM easier
>in the 95% case if that eliminates its use for 5% of your projects? Should
>JDOM become just a Java developer's view of XML, warts and all? Is that
>enough of an improvement over DOM to make JDOM worthwhile?
>
I believe we could do both: a clean Java API and a clean XML model.
For instance, the DocType confusion you cite can be cleaned up in the
implementation without changing the API at all. For the 95% of
developers who don't care about where the DOCTYPE is it just works.
For those 5% who do care, it works too.
I believe an XML API should be as simple as possible *and no
simpler*. My goal is that when a developer is surprised by JDOM, that
they're surprised because XML is surprising and not because the API
is surprising. (and sometimes XML is surprising. I'm still finding
funky stuff in XML 1.0 I didn't know was there, and I've been doing
XML more or less non-stop for five years now.)
--
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| The XML Bible, 2nd Edition (Hungry Minds, 2001) |
| http://www.cafeconleche.org/books/bible2/ |
| http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
+----------------------------------+---------------------------------+
More information about the jdom-interest
mailing list