[jdom-interest] API Inertia

Kenworthy, Edward edward.kenworthy at exchange.co.uk
Wed May 2 02:32:42 PDT 2001


Why should a model (the node) care about its rendition (pretty printing etc)
? 

-----Original Message-----
From: Elliotte Rusty Harold [mailto:elharo at metalab.unc.edu]
Sent: 01 May 2001 16:44
To: jdom-interest at jdom.org
Subject: Re: [jdom-interest] API Inertia


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/     |
+----------------------------------+---------------------------------+
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com



More information about the jdom-interest mailing list