[jdom-interest] detach() [eg]
Kenworthy, Edward
edward.kenworthy at exchange.co.uk
Wed Apr 18 08:06:18 PDT 2001
Personally I think if you wipe the document there shouldn't be a root
element of any kind. However any operation other than setting a root element
should throw an invalid state exception.
-----Original Message-----
From: Brett McLaughlin [mailto:brett at newInstance.com]
Sent: 18 April 2001 15:25
To: jdom-interest at jdom.org
Subject: Re: [jdom-interest] detach() [eg]
What if we made the name of that element more obvious that it was the result
of a developer error, as that's what it is. Something like
<missing-root-element/>
or something. That would go a long way towards making me feel more
comfortable here. Anyone else?
-Brett
----- Original Message -----
From: <philip.nelson at omniresources.com>
To: <jdom-interest at jdom.org>
Sent: Wednesday, April 18, 2001 8:38 AM
Subject: RE: [jdom-interest] detach() [eg]
>
> > There are a thousand or more ways to produce an ill-formed document
> > using JDOM.
>
> I don't think there are, really! I have been trying to exercise all the
set
> and add methods with bad data. I have verified in excruciating detail
that
> the Verifier only allows valid xml characters, names and content. My
> intention is to take the entire suite of OASIS/NIST xml tests (at least
> those I can get to parse) and run them through JDOM. If you see some other
> big holes, bring 'em on! I've already got 132 tests released, more in the
> works (Document is next) and each tests contains from 2 to 20 assertions.
>
> > Hopefully, all of them are programmer errors, like
> > forgetting to add a root element to the document. I can't think of a
> > good excuse for shoehorning <a-random-element /> into the root
> > position, in defiance of the expectations of the programmer who just
> > emptied the document out *on purpose*, and I don't agree that
> > well-formedness is a sufficiently good excuse--certainly not
> > as long as
> > one can add children to elements that do not belong there (JPanel,
> > java.sql.Connection, java.util.HashMap).
>
> You may not agree that it's worth it, but I don't agree that in JDOM's
case
> that the api is in defiance of the programmer's expectations. Honestly,
if
> I did something stupid like expecting my document to ouput after I emptied
> the content (naturally this would NEVER happen), I would find it far more
> useful viewing the broken document had a <placeholder /> element than the
> outputter throwing a NullPointerException that I would have to
troubleshoot.
> >
> > In other words, if we're going to enforce well-formedness,
> > then we have
> > to enforce it (and in the process, take power and flexibility
> > away from
> > the programmer; it always happens that if you dull a knife to keep it
> > from cutting someone's hands, it's harder to cut the bread). We have
> > to enforce it *everywhere*, and not just here, in a place where it's
> > easy.
>
> Well danged if we don't have a sharp knife AND a big hammer!
> _______________________________________________
> To control your jdom-interest membership:
>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
More information about the jdom-interest
mailing list