[jdom-interest] addContent in Element redefined in JDom 10

Brent "Bud" Taylor taylorba at comcast.net
Thu Mar 4 18:28:54 PST 2004

I think JDOM is a great extension to the core Java language. Congratulations
on becoming JSR-102.  I do have a concern for the API change that was made
between JDOM B9 and JDOM B10.  The Element class used to define several
methods for addContent().  This has now been changed to only a few methods
that either take a Collection or a Content object as a parameter.  The
problem comes in if the Content being added is a Parent.


For Example, my code used to contain the following statement:


Element trTag = new Element("TR").addContent(new
Element("TD").addContent("Data in the Table"));


I can no longer do this because the addContent method now returns an
instance of a Parent class.  In order to make this work, a cast to a Content
class must be inserted.  


Element trTag = (Element)new Element("TR").addContent((Content)new
Element("TD").addContent("Data in the Table"));


Personally, I liked the addContent() methods of JDOM-B9 more than I am
liking the addContent() methods of JDOM-B10..


-- Bud

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20040304/9453627f/attachment.htm

More information about the jdom-interest mailing list