[jdom-interest] API Inertia

Elliotte Rusty Harold elharo at metalab.unc.edu
Tue May 1 08:44:28 PDT 2001


At 11:37 PM -0700 4/30/01, Jason Hunter wrote:

>Brett, you know me better than to think I make silly arguments.  It's
>not that I'm worried about the "XMLOutputter internals".  It's that I'm
>worried about exposing a *false* API.  If XMLOutputter has an
>output(Node) method and in reality it can't output Amy's funky
>Node-implementing classes which she wants to write, then it's *lying*
>about what it can output.  An output(Node) method only makes sense if
>Node has a way to help the output, as if Node had a getSerializedForm()
>method.  But you want to use this to *avoid* getSerializedForm().  So
>you're stuck.
>

I think I see a way around that. We do make Node implement 
getSerializedForm(). We make that method take as an argument an 
object which provides all the current state of the outputter (e.g. 
whether to pretty print, whether to use empty element tags, where to 
break lines, etc.). Then we do have XMLOutputter depend on 
getSerializedForm() in the nodes.
-- 

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