[jdom-interest] XMLOutputter to the rescue (get/setText)
jhunter at acm.org
Wed Jul 11 17:57:50 PDT 2001
Interesting suggestion, Mr Alex "XMLOutputter" Chaffee. If people write
in saying they want this, I'd have no problems with you adding it.
Alex Chaffee wrote:
> I propose using (recommending to use) XMLOutputter.
> XMLOutputter already works for the case where you want to preserve the tags:
> new XMLOutputter().outputElementContent(element, out)
> will return "\n Do <b>not</b> eat the <font color="#FFFF00">yellow</font>
> snow.\n" which is probably what many people will really want anyway -- it's
> suitable for sticking in a JSP or whatever.
> If you *don't* want to preserve the tags, I can add a property to
> XMLOutputter, omitTags, that will handle that. Coupled with the intelligent
> whitespace handling that's already mostly working, and which I promise to
> get wholly working as soon as my latest patch is accepted, it will mean
> XMLOutputter textonly = new XMLOutputter();
> textonly.outputElementContent(element, out);
> "Do not eat the yellow snow."
> which is probably what the other half of mixed contenteers want.
> No need to overload the semantics of Element to become a utility for
> outputting a variety of text formats -- that's what XMLOutputter is for.
> (We could also make a "TextOutputter" that could be a bit more efficient at
> doing the job, but I think XMLOutputter can handle it.)
> - A
More information about the jdom-interest