[jdom-interest] Re: setAttribute???

Dave Churchville dmc at clearlight.com
Mon Jan 15 19:43:16 PST 2001


Just the set variety would seem the most convenient since you can't have
more than 1 attribute with the same name + namespace.  As long as you
can also "remove" the attribute, this seems to cover all the use cases.

--Dave

Jason Hunter wrote:
> 
> Dave Churchville wrote:
> >
> > Is there any reason why JDOM doesn't have a setAttribute( String name,
> > String value) method?
> >
> > addAttribute is fine when constructing new documents from scratch, but
> > if you are reading a document and want to modify a value, you currently
> > have to say "getAttribute, if not null, then set the Attribute value.
> > If null, call addAttribute".
> >
> > Admittedly, its not that hard, but setAttribute that would set the value
> > of the "Attribute" object if it exists, else create one and set it,
> > would be nice to have, and consistent with "setText" on Element.
> 
> So would you propose to have both "add" and "set" varieties?  Or just
> "set"?
> 
> -jh-



More information about the jdom-interest mailing list