[jdom-interest] API Inertia

Elliotte Rusty Harold elharo at metalab.unc.edu
Mon Apr 30 11:12:32 PDT 2001


At 1:40 PM -0400 4/30/01, Rosen, Alex wrote:
>
>>  Not at all... I want a lot more than Elements. I want all the
>>  content. Yes
>>  to Entities, Attribute, Elements, ProcessingInstructions...
>
>What about Strings?
>

To open yet another big yucky can of worms, I think Strings should be 
Nodes too. (I don't know what Brett thinks about this.) Since 
java.lang.String is final and Java doesn't have multiple inheritance, 
this means we need a text class that is not the same as string. This 
is a huge help for Xpath based apps including XPointer, XInclude, 
XSLT, and XLink.

And if you need another reason how about this: no API that relies on 
Java String objects for text nodes can correctly implement XML 1.0. 
Forget namespaces, forget XPath and XSLT and the Infoset. Regular 
ordinary XML 1.0 allows characters that cannot be represented in a 
Java string! I can write well-formed XML 1.0 documents that JDOM 
cannot handle! With a Text class we could fix this, but we can't fix 
it as long as we're building on top of String, and have to live with 
String's two-byte brain damage.

(By the way, this problem is not unique to JDOM. Java implementations 
of SAX and DDOM have it as well, but wouldn't it be cool to say we 
were the only XML API for Java that's fully conformant to XML 1.0?)
-- 

+-----------------------+------------------------+-------------------+
| 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