[jdom-interest] Re: Comments on JDOM b10-rc1
Bradley S. Huffman
hip at cs.okstate.edu
Wed Feb 11 21:33:56 PST 2004
Elliotte Rusty Harold writes:
> It most certainly does, as defined by the XPath 1.0 spec, it's the
> same as the value of the root element.
Your are certainly correct, Sec. 5.1. I must of read that spec. 8-10 times
now and everytime I guess I was equating root node to root element. Man,
I wish they would use the same terminology throughout their specs.
> > You cann't add or detach it from anything.
> detach is a no-op. Node doesn't have methods to add either (unless
> you count setParent)
It's not a no-op, just another of those convenience methods.
> The advantage is a much cleaner programming model. The advantage is
> being able to treat a tree as a tree, rather than having to operate
> differently depending on what part of the tree you're in, and what
> type of node you're processing at the moment.
Sounds good, but I don't see it. Documents and elements have different
rules about what content they can contain, so you already have to operate
differently depending on what part of the tree your in.
Parent contains the methods common to both documents and elements (except
a getValue, which is due to my lack of reading comprehension). I just don't
see how Document being a subclass of a Node, the same a Text or Comment,
But one thing I really don't like about Document being a Node is
addContent(Node document) takes a situation that couldn't happen and now
makes it a runtime exception.
More information about the jdom-interest