[jdom-interest] Important proposal: Element/Document changes

Jason Hunter jhunter at collab.net
Tue Jul 25 10:08:46 PDT 2000

philip.nelson at omniresources.com wrote:
> I am not overwhelmed by this proposal.  Not because the ideas aren't good,
> but because they aren't that much improved over the current api.  I recently
> brought two developers who, while experienced programmers (Smalltalk, C++,
> VB)had little Java and no XML background.  In less than two weeks time, they
> are able to move around JDOM based classes with ease (except for some nasty
> NullPointerExceptions =8^( )

Are you saying you like the changes or not?  I'm confused.  :-)

> getContent would be better of course.  Fine with all whitespace.  Since the
> old getContent returned a String, wouldn't the compiler catch those?

Yes, but if you use already compiled code you'll get weird runtime
errors.  But more importantly, it's easier for people to understand that
names change, harder that fundamental behaviors change.  And besides, it
is mixed content you're getting.

> I remember fixing "legacy" code with getAttributeValue.  It was decided that
> getAttribute().getValue() was just as fast to type.

Cept for those NPEs.

> > Element addContent(String text)
> > Element addContent(Element element)
> > Element addContent(ProcessingInstruction pi)
> > Element addContent(Entity entity)
> > Element addContent(Comment comment)
> OK but we get text with getText() and set it with addContent() OR setText()?
> Or is this ONLY for addContent("<achild>foo</achild>")?  Would this be
> enforced? Will setText() only allow plain text? I'm confused

addContent() adds the string to the list.  setText() does a set and
replaces all the content with the text.  This is in line with current

> > boolean removeChild(String name)
> > boolean removeChild(String name, Namespace ns)
> > boolean removeChildren(String name)
> > boolean removeChildren(String name, Namespace ns)
> I prefer this naming style because it's shorter and less of a change from
> what current example code and Brett's book shows.


> Makes sense.  DocType remains the same?  Does setRootElement() and
> getRootElement remain?



More information about the jdom-interest mailing list