[jdom-interest] Default document constructor

Jason Hunter jhunter at acm.org
Tue Jan 8 12:08:25 PST 2002


Nothing's wrong with it in my opinion, and in fact the TODO item remarks
about how this helps the Document(null) case.  I think actually when we
get the ISE working it'd make sense to have a no-arg Document
constructor.

-jh-

"Bradley S. Huffman" wrote:
> 
> What's wrong with the idea in the TODO list, "allowing a Doc to have its
> root removed with an ISE upon later access".
> 
> You get the convenience of a 'naked' Document, but are still protected
> from non-well-formness.
> 
> Brad
> 
> Jason Hunter writes:
> 
> > You explained the issue quite nicely.  It's a nice-to-have feature but
> > on the other hand you're creating a non-well-formed document.  Right now
> > we're in a compromise state with passing null as a power-user feature.
> > Any push to the other direction hits resistance.
> >
> > -jh-
> >
> > Kevin Jones wrote:
> > >
> > > Why is the default Document constructor protected?
> > >
> > > I can understand logically that a Document should contain some content
> > > (and according to the XML specs must contain a root element) but it
> > > would often make my programming logic more logical if I could create an
> > > empty document and then add content to it, rather than creating content
> > > first and constructing the document with that content.
> > >
> > > I can create an empty document (in at least two ways I think)
> > >
> > > e.g.
> > > new Document((org.jdom.Element)null);
> > >
> > > where the cast could also be to java.util.List.
> > >
> > > or
> > >
> > > elem = new Element("foo");
> > > doc = new Dcoument(elem);
> > > elem.detach();
> > >
> > > And this is sometimes necessary (especially the second case), so 'naked'
> > > Documents are possible. This would seem a nice-to-have feature,
> > >
> > > Kevin Jones
> > > Developmentor
> > > www.develop.com
> > >
> > > _______________________________________________
> > > To control your jdom-interest membership:
> > > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourho
> > st.com
> > _______________________________________________
> > To control your jdom-interest membership:
> > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost
> > .com



More information about the jdom-interest mailing list