[jdom-interest] About PI-Urgent

Jeelani sjeelani at infinitymarkets.com
Thu Jan 11 01:58:32 PST 2001


Even I too agree that, it will be more convenient to have a constructor
which takes mixedContent as parameter.

But, in the case where we need to either add or modify PI and Comment
of an existing xml document, there is no direct way of doing it.


-----Original Message-----
From:	Rosen, Alex [SMTP:arosen at silverstream.com]
Sent:	Thursday, January 11, 2001 5:33 PM
To:	jdom-interest at jdom.org
Subject:	Re: [jdom-interest] About PI-Urgent

> > 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

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.

To control your jdom-interest membership:

More information about the jdom-interest mailing list