FW: [jdom-interest] Doctype entity declaration

Jason Hunter jhunter at collab.net
Tue Mar 13 19:39:39 PST 2001

Harry Evans wrote:

> While I was designing for Doctype entity declarations, I noticed that
> DocType, unlike Element, Entity, Comment, etc. does not have a reference to
> the containing Document.  Is this by design, or oversight?  It seems to me
> that it would be good to find the enclosing document for a doctype
> declaration.  Any thoughts on this?

It's due to the fact that DocType doesn't really seem like a leaf on the
document tree.  It's more like an attribute of the document.  That said,
a DocType instance should probably either be immutable or should have a
parent; thus ensuring you can't have the same DocType on two docs and
have a change to one affect the other.  

We should determine if XPath would be helped by DocType knowing its
parent.  If so, I'd propose adding the parent.  If not, then I'd propose
making it immutable.  Bob, do you want to weigh in?


More information about the jdom-interest mailing list