[jdom-interest] detach() [eg]

Jason Hunter jhunter at collab.net
Thu Apr 19 10:59:06 PDT 2001


philip.nelson at omniresources.com wrote:
> 
> What if we had getRootElement() throw an Illegal<something>Exception when
> the placeholder was there?  Then it wouln't matter at all how the internal
> state was kept.  Other than to see if you have this bogus Document, I can't
> see any valid reason you would want to get the root element.  If you try to
> output the document, you would get a meaningful error.  If you can't be
> sure, you can attempt to get the root element and use a try catch to do the
> right thing.  Meanwhile, everything else works exactly the same way.
> Element.MISSING_ROOT_ELEMENT would have the meaningful text to use in the
> exception and could be protected an it's presence gives you a nice location
> to document the behaviour.

I like this idea.  Is it consistent though with our goal that JDOM docs
in memory are well-formed?  We'd have well-formed, or malformed but
you'll get an exception when you try something with them.  Hmm...

-jh-



More information about the jdom-interest mailing list