[jdom-interest] XMLOutputter naming questions

Alex Chaffee guru at edamame.stinky.com
Sun Oct 1 13:36:09 PDT 2000


On Sun, Oct 01, 2000 at 12:41:35PM -0700, Jason Hunter wrote:
> > - remove setIndenting() -- it's redundant with setIndent() and
> > confusing to boot.  
> 
> It was modeled after the XMLC outputter, which had both.  I presume it's
> because not everyone realizes that setIndent("") turns off indenting. 
> It also allows you to temporarily turn it off with a flag, then restore
> it to its original size, without recording the size.

Now that I've added a copy constructor (I've been a busy boy!), this
scenario can be accomplished with

  XMLOutputter second = new XMLOutputter(first);
  second.setIndent(false);

(I also made it implement Cloneable, so XMLOutputter second =
(XMLOutputter)(first.clone()); should work as well.)


> >  Is anyone really in love with setIndenting(true)?  
> 
> Just trying to throw out possible uses.  I'm not in love with it.  :-)

OK, so then it won't break your heart if I fix it :-)


> > versus:
> > 
> >         void output(Document d, OutputStream out)
> >         void output(Element d, OutputStream out)
> >         String outputString(Document d)
> >         String outputString(Element e)
> 
> This is fine.  But how about getString() instead of outputString()?
> 
> String doc = outputter.getString(d).
> 

-1

> vs
> 
> String doc = outputter.outputString(d).
> 

+1 on outputString, since "get" generally refers to a *property* of
the object, and String is not a property.  "outputString" is more
descriptive of what it's really doing.


-- 
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