[jdom-interest] PROPOSAL: Remove most constructors from XMLOutputter (was round trip XML)

Alex Chaffee guru at edamame.stinky.com
Tue Oct 17 15:50:47 PDT 2000


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):
http://www.jdom.org/docs/apidocs/org/jdom/output/XMLOutputter.html

 - Alex

-- 
Alex Chaffee                       mailto:alex at jguru.com
jGuru - Java News and FAQs         http://www.jguru.com/alex/
Creator of Gamelan                 http://www.gamelan.com/
Founder of Purple Technology       http://www.purpletech.com/
Curator of Stinky Art Collective   http://www.stinky.com/



More information about the jdom-interest mailing list