[jdom-interest] Document getRootElement() problem
bryanb at upshot.com
Wed Jun 14 15:28:57 PDT 2000
SAXBuilder uses the Document(null) constructor to create the document.
The spitfire parser's JDOM builder also uses the Document(null) costructor
for the same reasons as SAXBuilder. Further the protected constructor
Document() is not available to the builder, and at the time the Document
object is created no elements have been retrieved yet.
> -----Original Message-----
> From: Jason Hunter [mailto:jhunter at acm.org]
> Sent: Wednesday, June 14, 2000 12:46 PM
> To: Elliotte Rusty Harold
> Cc: jdom-interest at jdom.org
> Subject: Re: [jdom-interest] Document getRootElement() problem
> > In Document.java I noticed the following:
> Since b4 I've fixed the comments to match behavior.
> > Personally, my preference is, from most preferred to least
> > 1. Prevent creation of Document objects with null root elements.
> That was our basic plan too. You must pass in an Element to the
> Document constructor, so only if someone explicitly passes null might
> you have a problem. We could do a null check in the constructor, but
> since we have the no-arg constructor for special clients to use, we
> can't be 100% sure it'll never be null. Hmm... In Element we just
> don't worry about the no-arg constructor and trust that subclasses do
> the right thing (and allow NPEs if they don't). We could do
> that here,
> checking for null at construction and not at getRootElement()
> time. I'm
> OK with that. Opinions?
> To control your jdom-interest membership:
uraddr at yourhost.com
More information about the jdom-interest