[jdom-interest] So many constructors for Element ?

Paul Libbrecht paul at mathweb.org
Wed Aug 29 14:33:01 PDT 2001


Hi,


Enjoying jdom still quite much...

I am at about my fifth subclass of element and I'd have a comment and a 
suggestion:

1) 	the number of constructors for Element is a pain in the...
	Is this something really wanted when a Namespace can simply be null ?
	This is especially true as, trying to ignore the source of Element, I
	put my test code (mostly on the name of the elemenet) all the five 
times.
	I could certainly reduce this to two or three... if I pasted the 
source of Element.java
	but that's what subclassing is.

	And of course JDOMFactory must implement all of these...

2)	Why doesn't JDOM have more interfaces ?
	In particular, several of my element types are actually interfaces so 
as to allow
	multiple inheritance. I have no guarantee, however, that the classes 
implementing
	these interfaces are indeed subclasses of Element. Would it not make 
sense
	to have an Element interface and possibly a Node interface (with simply
	getParent, getDocument, detach... to be discussed).
	And I am really, really, really, not saying this without knowing the 
disaster of
	DOM interfaces (my taste). No way... we do have an implementation
	so we can still create Elements (and move them around)
	and won't restrain doing so.

	Maybe in a later version...

Paul



More information about the jdom-interest mailing list