[jdom-interest] Document changes tonight

Jason Hunter jhunter at acm.org
Fri Aug 11 02:30:53 PDT 2000


I had some time to spare tonight and made some progress on our planned
JDOM method name migration.  Tonight's focus was the Document class.  I
have it now pretty much in the form as proposed in the July 25 email. 
You can see my checkin messages as the last 9 posts to jdom-commits:

http://lists.denveronline.net/lists/jdom-commits/2000-August/date.html

The code has been only lightly tested, so there may be bugs.  Please
report any you find to the list.  Feel free to look over the
Document.java code too.  It gets a little fancy about how it handles the
root element.  It essentially holds a cached pointer to it and has some
special code to handle this.  I wouldn't have written such special logic
if I were starting from scratch, but since it was already there from the
old model, I figured I might as well keep it.

One thing I'm not sure about.  Do we need doc.addContent(Entity)?

Also: What do people think about making the default Document()
constructor public?  It's currently protected, and the logic for not
having it public was that every document needed a root -- but then all
over the place we call new Document(null) so we can construct the
document in pieces like this:

new Document(null)
  .addContent(new Comment("before"))
  .addContent(new Element("root"))
  .addContent(new Comment("after"));

We shouldn't have a null parameter to the constructor be some sort of
secret enabler like this, imho.

-jh-



More information about the jdom-interest mailing list