[jdom-interest] Element.getContentTrim() ?

Alex Rosen arosen at silverstream.com
Mon Oct 8 08:14:13 PDT 2001


We talked about this recently. (Actually that proposal was to have getText()
recurse into child nodes, which I think is pretty much the same as what
you're asking for.) My arguments against this are
http://www.servlets.com/archive/servlet/ReadMsg?msgId=117571&listName=jdom-i
nterest and
http://www.servlets.com/archive/servlet/ReadMsg?msgId=118234&listName=jdom-i
nterest.

> I'm sure all of you know how this would look in HTML.
> Unfortunately, an HTML
> display program would need to do getContent() so that it can
> cause the <b>
> elements (and other markup) to have their usual HTML effects,

However, JDOM is designed for XML, not any specific flavor like HTML/XHTML.
Are you proposing this so that someone who is using JDOM to do HTML-like
stuff doesn't have to do the work to get the child elements themselves? I
don't think that something like that belongs in a general-purpose XML
library.

> while still
> supporting plain old text, trimmed in the usual SGML/HTML/XML way.

There is no usual way to trim XML text - XML doesn't have this notion. Any
trimming, normalizing, or recursion we add is something we've made up to
support a particular style of XML. There are many different styles of XML,
and that's why I don't think that any of those things belong in the main
JDOM classes.

Alex




More information about the jdom-interest mailing list