[jdom-interest] Rootless documents

Jason Hunter jhunter at apache.org
Mon Apr 8 16:21:08 PDT 2002


> > Can somebody remind me what the use-case for rootless documents was? I'm
> > working on the JDOM chapters of Processing XML with Java and I'm having
> > trouble justifying this to my readers.
> 
> Mainly in building a document. SAXBuilder is one example where it creates
> a new Docuement (in startDocument), then adds content as it is found.

Yes, look at the builders where you want to get a Document object and
then start filling it with content.  It's much easier if you can
temporarily have a non-rooted Document.  We'd been doing it earlier by
passing null to the constructor (because trying to pre-create the doc's
content before creating the Document was really ugly).  That loophole
was bad so we made it officially allowed with the ISE checks for
safety.  I remember lots of users piped in that they were interested in
this feature.  It wasn't driven by the builders, but those who wanted it
were able to say, "Even you need it, why not let us have it."

-jh-



More information about the jdom-interest mailing list