[jdom-interest] hasMixedContent()
Alex Rosen
arosen at silverstream.com
Tue May 15 21:59:30 PDT 2001
philip.nelson at omniresources.com wrote:
> I've never used hasMixedContent. As I recall, the use case had to do with
> text interspersed with elements and other nodes. It allowed you to safely
> assume you were dealing with only the textual content if you
> used getText(). Is this still true?
As far as I can tell, it doesn't do anything useful now. It returns false if
all the children of the Element have the same Java class, otherwise it returns
true. This is probably even less useful than it used to be, now that we have
CDATA objects.
I can imagine wanting a method that tells you if the Element has no children
other than Strings and/or CDATAs. That would mean that if you called getText(),
you'd get all the information about the Element's children that was present. (I
can't tell if that's what you were saying or not.) But it would have to be
called something besides hasMixedContent(), and it doesn't seem like a common
enough case to warrant its own method (since you can just do it manually if you
really care). So, I propose we get rid of it.
Jason Hunter [jhunter at acm.org] wrote:
> I could live with its removal. Is that sufficient do you think?
Like I said, ideally I'd like to rename getMixedContent() to something more
appropriate, like getAllChildren(). But if we did that, then I think we'd have
to rename getChildren() to something like getChildElements() to avoid
confusion. I'd love to do that, but I know we had a big discussion about it a
while ago, and I don't feel strongly enough about it to really fight for it.
What do other people think?
Alex Rosen
SilverStream Software
More information about the jdom-interest
mailing list