[jdom-interest] About PI-Urgent

Rosen, Alex arosen at silverstream.com
Thu Jan 11 09:33:25 PST 2001


> > and I didn't get the logic behind implemetation of addContent(PI)
> > and addContent(Comment) to append the same at the end of document.
>
> This has been heavily discussed in the archives.  I'll add a FAQ about
> it later too.
>
> -jh-

This is a very common complaint/misunderstanding. Perhaps it's common enough
that we should add prependContent(Comment) and prependContent(PI)? We only need
this in Document, since (1) this is by far the most commonly desired behavior
on a Document (prepend rather than append), and (2) with Element, you can
create an Element with no content, and then add the children in order, but you
can't do that with Document - instead, you have to go through these
contortions.

This would add 2 methods to the API, but if it's any consolation, I think you
can get rid of the 3 getProcessingInstruction() methods (as I mentioned a few
weeks ago). That's a net reduction in API!

BTW, was there discussion of why the no-arg constructor for Document is not
public, and why there's no constructor that takes mixed content? Either of
these would solve the problem too, and in a cleaner way I think.

--Alex



More information about the jdom-interest mailing list