Hi,
Since SimpleNodeIterator is basically the same as NodeIterator, I think it
should just extend NodeIterator and redefine the methods without throwing the
exceptions. Either that way or make NodeIterator extend SimpleNodeIterator. I
think its better design and leads to more uniform code.
Secondly, some anomalies that I noted. Not really serious but just from a more
consistent viewpoint.
Parser.elements() returns a NodeIterator
while CompositeTag.getChildren() returns a NodeList.
Ideally since both are returning the nodes, a common mechanism should be used.
Also NodeList.elements() returns a SimpleNodeIterator. This should also be
synchronized with the above so that one common class is returned.
This is pretty typical of Java classes : Vector has add() method and Hashtable
has put() method clearly showing that both were written separately. There are
many more such examples actually. We should try and avoid it.
Dhaval
|