[jdom-interest] AleXMLOutputter

Patrick Dowler Patrick.Dowler at nrc.ca
Wed Jul 19 10:53:24 PDT 2000

On Tue, 18 Jul 2000, Alex Chaffee wrote:
> > > > Anyway: why Elements, PIs, DocType etc.. don't extend the same basic
> > > > class?
> I agree. There should be a common Node interface/abstract class; we
> could easily write a print(Node n) method in the XMLOutputter that
> would work for all Nodes.

Having a common Node base class is useful only if there is common code 
or you have a suitable amount of calling code that does the same thing
(logically: it calls the same method) on all of them and doesn't care what
type they are.  I don't really see Element, Attribute, ProcessingInstruction,
and Comment sharing any code.

Also, using inheritance so you have one method like "print(Node n)"
is kind of a waste because then inside there you have to branch on
type when you could have let java do it for you with method overloading.


Patrick Dowler
Canadian Astronomy Data Centre

More information about the jdom-interest mailing list