[jdom-interest] round trip XML

Alex Chaffee guru at edamame.stinky.com
Tue Oct 17 11:06:15 PDT 2000


> > I'm reluctant to add this property to the constructor, since it's a
> > slippery slope.  In fact, I'd like to strip all but the default
> > constructor, but I can see how some find the extra constructors
> > useful.
> > 
> > On reflection, maybe there should be a constructor
> > 
> > XMLOutputter(boolean trimText, boolean newlines, boolean indent)
> 
> The indent art is currently a String (typically "   " or "").

There's also setIndent(boolean doIndent) which uses "  ".

> I'm not that keen on method signatures like (boolean,boolean,boolean)
> since it is always hard to recall what order things are in. Something
> like (int,int) is OK for position because everyone takes it as (x,y).
> 
> For convenience of writing the code, it seems that 
> 
> 	XMLOutputter()
> 	XMLOutputter(boolean pretty)
> 
> would suffice. If someone wants to actually tune the output precisely, making a
> few method calls is not too much to ask. Maybe pretty would give trimText,
> newlines, indent of 2-4 spaces, and a line-break after 80 chars. 

I kind of like that.  I was shying away from setPretty() but it might
be nice to have a shortcut "do what I mean" button.

 - A


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