[jdom-interest] XMLOutputter Proposal

Jason Hunter jhunter at collab.net
Tue Jun 12 14:42:31 PDT 2001


guru at stinky.com wrote:
> 
> Hi! I'm back on the list... It may take me a while to sort through the
> 4000 messages I haven't read, so please be patient with me...

There'll be a quiz afterward.

> I'm starting to track down a bug Jason told me about with
> XMLOutputter, and while I do, I'd like to fix something that's always
> bothered me about the class.
> 
> Right now, there are two boolean properties with negative names, and
> negative default values.  We all know that double-negatives are not
> unconfusing.  (If I want to make sure the encoding is shown, I have to
> stop and think about what value to send.  "Let's see, if I *do* want
> to *show* the encoding , then I *don't* want to *omit* it... or do
> I?")
> 
> So I'd like to change
> 
>     public void setOmitEncoding(boolean omitEncoding)
>     public void setSuppressDeclaration(boolean suppressDeclaration)
> 
> to
> 
>     public void setShowEncoding(boolean showEncoding)
>     public void setShowDeclaration(boolean showDeclaration)

There's another model to follow which is that all boolean flags default
to false.  That's what we follow now.  I prefer it, because then you can
look at the setters and see options you might want to do.  Think, "Do I
want to..."

text normalize
omit encoding
expand empty elements
etc

I agree Omit and Suppress should be brought in sync.  Hmm...

setOmitEncoding()
setOmitDeclaration()

That looks good.  I believe we should s/Suppress/Omit/.

-jh-



More information about the jdom-interest mailing list