[jdom-interest] mvoing mixed content

Alex Rosen arosen at silverstream.com
Wed Jul 25 11:02:30 PDT 2001

> 1. I would like to have an easy method for moving mixed
> content like: element.moveContent ( Element source ).

I'd just use:

List content = source.getContent();
source.setContent(new ArrayList()); // Should be able to pass in null
here, but can't right now, due to a bug in setContent().

I don't think this is a common enough operation to deserve its own
special method.

> I wonder why there is no common super class for all
> possible children of an Element?

Here's another suggested FAQ entry I sent in a while back, though it's
not up on the web site yet:

Q: Why don't JDOM classes like Element, Attribute, etc. implement a
common Node interface?

A: This issue has been discussed several times on the JDOM mailing list,
with several people on both sides. Jason Hunter summarized the argument
against a common Node interface:

"The problem is that the number of methods which JDOM objects have in
common or could have in common is close to zero.  Therefore to create a
Node we have to either allow methods which don't make sense for all
objects (like getMixedContent() on Attribute) or we have Node as really
just a marker interface.  Myself, I don't want to see non-sensical
methods because that's one of the core problems with DOM.  And I don't
see sufficient value for Node as just a marker interface for reasons
enumerated before.

Some people propose to get more methods into Node by restricting the set
of JDOM objects that would qualify as Nodes.  That tends to come at the
cost of other people's desire for everything in JDOM to be a Node."

For reference, the latest (rather lengthy) mailing list discussion on
this topic started April 29, 2001 with "Ideas for API changes". It
continued with "API inertia", "Philosophical XML", "Design Patterns",
and "Common Interfaces". It would help to review this discussion before
bringing this topic up on the mailing list.

More information about the jdom-interest mailing list