[jdom-interest] Again: Deprecating some XMLOutputter constructors
guru at stinky.com
guru at stinky.com
Sun Jul 1 09:26:09 PDT 2001
I posted this a few weeks ago. The thread got distracted in
whitespace issues. The only reply was Alex Rosen saying "all these
are fine with me." Shall I go ahead and submit a patch? Does anybody
use the first two anyway?
----- Forwarded message from guru at stinky.com -----
I used to think maybe XMLOutputter should have only a default
constructor, and that all configuration should happen with setters.
Now I realize the importance of new XMLOutputter("\t",
true).outputString(element) and the like.
I'd still like to deprecate/remove some constructors that seem
* public XMLOutputter(String indent)
since if you're setting indent, there's a 99.99% chance you're also
setting newlines, so you can just use XMLOuputter(String indent,
boolean newlines) -- I doubt if anyone has ever actually used this
* public XMLOutputter(String indent, boolean newlines, String encoding)
since I personally consider encoding to be an "optional" feature, so
why should encoding get its own constructor, when other optional
features like setting the line separator don't? Does anyone use
encoding regularly enough to justify this being a constructor rather
than a setter?
I'd also like to *add* a constructor:
* public XMLOutputter(String indent, boolean newlines, boolean normalizeText)
because that would be all you need for "pretty-printing", which is
probably what people what 80% of the time. (The other 20% they want
minimal, no-frills output, which is enabled by the default ctor.)
Then when people ask "how do I get pretty-printing?" the answer is
new XMLOutputter(" ", true, true).output(document, System.out);
XMLOutputter outputter = new XMLOutputter(" ", true);
Minor issues, I know, but we may as well deal with this now.
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/
To control your jdom-interest membership:
----- End forwarded message -----
More information about the jdom-interest