[jdom-interest] XMLOutputter to the rescue (get/setText)
jonbaer at digitalanywhere.com
Wed Jul 11 18:29:37 PDT 2001
I am a +1 for it.
Jason Hunter wrote:
> 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.setOmitTags(true);
> > textonly.setTextNormalize(true);
> > textonly.outputElementContent(element, out);
> > gives
> > "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
> To control your jdom-interest membership:
More information about the jdom-interest