[jdom-interest] More changes
Chris Atkins
atkicd at aud.alcatel.com
Wed Jul 19 13:57:53 PDT 2000
> -----Original Message-----
> From: jdom-interest-admin at jdom.org
> [mailto:jdom-interest-admin at jdom.org]On Behalf Of Elliotte
> Rusty Harold
> Sent: Wednesday, July 19, 2000 11:40 AM
> To: Brett McLaughlin; jdom-interest at jdom.org
> Subject: Re: [jdom-interest] More changes
>
>
> At 10:35 AM -0500 7/19/00, Brett McLaughlin wrote:
>
> >* What do people think about removing the convenience methods (like
> >getIntContent()) on Element.java? Mark Diekhans pointed out
> that getting
> >a default value from an attribute is quite different from getting one
> >from an Element - typically, it means the Element is optional, or not
> >there, but we also return the default if the /format/ is
> incorrect. For
> >example:
> >
> ><port>yl7</port>
> >
> >getPort(80);
> >
> >This currently returns 80, and should really result in an error - it
> >masks problems in the underlying XML, which is generally a
> bad thing, I
> >think. It is very hard to track this down, and different
> programs using
> >different defaults can really obfuscate the document. So I'm actually
> >for removing all the getXXXContent methods (but only on Element.java,
> >not Attribute.java, where they make more sense).
> >
>
I prefer leaving in the getXXXXContent() methods. I do see that the
getXXXContent(defaultvalue) methods should be dropped from the element.
These are a convienance to the user and make the interface much easier to
use. Most users will probably come up with them themselves.
For attributes, if the attribute is not defined as #implied, the
getXXXXContent(defaultvalue) methods do not make any sense. Does jdom know
if an attribute is defined as #implied so it could throw an exception?
Chris Atkins
More information about the jdom-interest
mailing list