[jdom-interest] Re: jdom-interest digest, Vol 1 #297 - 12 msgs

Joseph Bowbeer jozart at csi.com
Wed Oct 18 15:05:14 PDT 2000


I think your proposed simplification of XMLOutputter is a good thing.  I
would even go so far as to remove the (XMLOutputter) constructor.

In other words:

  +1 the () but
  -1 the (XMLOutputter)
  +1 the (pretty)

Concerning the (XMLOutputter) constructor and the equivalent clone()
form, I don't understand why these would ever be very useful.  Can't
XMLOutputter simply be reused?  Or is XMLOutputter maintaining state?

If it's maintaining state, why not provide a reset() method?

Also, what exactly does 'pretty' do?  I'm especially interested in
knowing exactly what whitespace is added/removed to/from element
content.  What happens to whitespace outside element content is less
important, but I'd also like to see this defined.

Since all whitespace in element content is potentially significant, I
suggest providing separate options for the whitepace and other "detail"
lying outside the element content. For example: provide a separate
option for the newline(s) after the XML header and the newline at the
end of the document.  Also, how about an option controlling the
'standalone' setting in the XML header?

Finally, does the option that lets the user set the indent character
carry it's weight?  Would it be simpler and just as useful to have a
single int-type property setting for the indent level instead?

Joe Bowbeer

----- Original Message -----
Date: Tue, 17 Oct 2000 15:50:47 -0700
From: Alex Chaffee <guru at edamame.stinky.com>
To: Brad Morgan <Brad.Morgan at e-pubcorp.com>
Cc: jdom-interest at jdom.org
Reply-To: alex at jguru.com
Subject: [jdom-interest] PROPOSAL: Remove most constructors from
XMLOutputter (was round trip XML)

On Tue, Oct 17, 2000 at 10:08:19AM -0600, Brad Morgan wrote:
> I agree with you on the constructor issue.  I think adding the new
> ones is the upwardly compatible thing to do, but I'm acceptable to
> removing all but the default as well.  Either change produces a more
> consistant interface.  The current set of constructors seems lacking
> in consistancy given the ways in which people are tending to use
> them (pick a constructor that almost does what you want, then fine
> tune with methods).

I'd like to do this.  Can I have a straw poll on the following?

Remove all constructors from XMLOutputter except for the
following. Please vote separately if you want to, say, +1 the () but
-1 the (XMLOutputter)

1. XMLOutputter()
preserve whitespace, don't add newlines or indents

2. XMLOutputter(XMLOutputter other)
copy properties from other

3. XMLOutputter(boolean pretty)
true: trim whitespace, add newlines and indents
false: trim whitespace, don't add newlines or indents

Note that 2 is redundant with (XMLOutputter)other.clone(); I'm leaning
towards eliminating it too (even though I'm the one that wrote it :-)

Note also that 3's "false" is for the "compactest" output; I figure
that's a common enough use case that there should be a way to specify
it in the constructor.

Please see JavaDoc for the current confusing set of constructors, and
for all the properties you can set (proving it's unfeasible to set all
of them in the constructor):

 - Alex

More information about the jdom-interest mailing list