[jdom-interest] Re: XMLOutputter and Comments

Jason Hunter jhunter at collab.net
Wed Jun 21 12:22:01 PDT 2000


> I've revised XMLOutputter to add these three methods:

Checked it in.

> protected void printText(String text, Writer out, int indentLevel)
> throws IOException
> 
> Overriding it would allow subclasses to customize how text is arranged;
> for example, allowing them to turn word wrapping on or off. The problem
> is this might require different algorithms depending on whether or not
> the text was part of mixed or string only content.  For mixed content
> it's fairly straight-forward, but for string only content you'd want to
> be able to affect the wrapping of the start and end tags too. Maybe
> what's really needed is separate protected methods to handle empty
> elements, string only elements, and mixed content elements which
> printElement() would call. For example:
> 
> protected void printMixedContentElement(Element element, Writer out, int
> indentLevel) throws IOException
> protected void printStringOnlyElement(Element element, Writer out, int
> indentLevel) throws IOException
> protected void printEmptyElement(Element element, Writer out, int
> indentLevel) throws IOException
> 
> Thoughts?

Can you explain cases where you'd want to do things differently?

-jh-



More information about the jdom-interest mailing list