[jdom-interest] XMLOutputter newline and sockets

philip.nelson at omniresources.com philip.nelson at omniresources.com
Thu Aug 23 08:14:01 PDT 2001


> as java.text.Format.  The basic interface is that you pass in 
> an object and
> it returns a StringBuffer which is then written to the 
> stream.  That's just
> another step in the chain to output the text.  Since JDOM is 
> supposed to be
> fast, adding more overhead is probably the wrong way to go.



> pretty heavy class if you don't care about formatting.  There 
> is a lot of
> logic to support pretty printing.

And that logic is something that is pretty thoroughly covered in other apis.
I don't ever want to get in the business of putting lots of formatting code
into my applications.  If you had this formatting code, wouldn't it then
make sense to have some sort of gui to edit all those whitespace options?  

On one extreme, XSLT can do everything you need to do with formatting.
Velocity is another attractive option if the fixed part of the document is
larger than the variable part.  Another technique I use sometimes that is no
less painful than outputting from a format class to a stringbuffer on
resources, is to load my document, manipulate it in the way that has made
JDOM popular, then load another document that has no data but is formatted
the way I want.  Then just merge the modified one to the template and output
that without setting formatting options at all.

I just don't think this part of the api should be something we should focus
much on.  There's plenty of other things that would be more valuable.

More information about the jdom-interest mailing list