[jdom-interest] detach() [eg]

Jason Hunter jhunter at collab.net
Fri Apr 20 01:04:13 PDT 2001

Joseph Bowbeer wrote:
> I wonder, too.
> Adding a place-holder may preserve the well-formedness of the document, but
> it probably doesn't preserve the validity.
> If we can have root Elements with no associated Document and non-root
> Elements with no parent, what's so bad about Documents without roots?

Under the current design, what a developer can trust is:  Any JDOM
Document is a well-formed document, and any JDOM Element is a
well-formed document fragment.  So if you're writing an outputter or doc
manipulator, you know you don't have to check any well-formedness. 
It'll be checked for you.

Note you can't really have a root element with no associated document. 
If there's no doc, it's not a root element, it's just an element.

Yes, it's ugly to have a root replacement added.  It's also ugly to
break the well-formedness contract.  Which one's less ugly?


More information about the jdom-interest mailing list