[jdom-interest] Parents - why do we need them?

Elliotte Rusty Harold elharo at metalab.unc.edu
Tue Jul 3 06:56:58 PDT 2001

At 2:43 PM -0500 7/1/01, philip.nelson at omniresources.com wrote:

>Here is another idea, definately not thought through but I throw it up for
>discussion.  One of the great unresolved parts of the api is the null and
>bad type addtion problem with the lists.  We are assuming that the best idea
>is to filter these out on the insertion.  Yet this idea of a shared
>attribute, points to another idea.  What if the default behaviour of the
>outputters was to ignore anything that wasn't a core JDOM class/subclass.
>Nulls? disregard.  JTextBox? disregard.  Take the unhandled branch of the
>outputter iteration one step further though and allow for a custom renderer
>to be plugged in and a whole new range of patterns becomes possible.

NO! NO! NO! Are we really just filtering them out? How awful, whether we do it on insertion or output. If a JTextBox is getting added to an Element, then something very weird is going on. We need to alert the developer of this in the standard Java way by throwing an exception, possibly a runtime exception since this is so weird, but definitely we should throw an exception. We should not sweep the problem under the rug by letting it silently fail. 

| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
|          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
|              http://www.ibiblio.org/xml/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.ibiblio.org/xml/     |

More information about the jdom-interest mailing list