[jdom-interest] attributes
Noam Tamim
noamt at yahoo.com
Wed Jan 30 15:13:04 PST 2002
--- Hallvard Tratteberg <hal at idi.ntnu.no> wrote:
> > elt.setAttribute("foo", "bar") is a convenience method for the above
> > syntax, which is why it does a replacement. One could argue it
> > shouldn't, and one can argue it should.
> I would've thought the latter was equivalent to
> Attribute attr = elt.getAttribute("foo");
> if (attr != null)
> attr.setValue("bar);
> else
> elt.setAttribute(new Attribute("foo", "bar"));
> What is the motivation for the "always replace" logic? I don't get it. If
> the reasons are good, perhaps we need an ensureAttribute method?
Or, a setAttribute(String name, String value, bool createNew) method.
=====
Noam.
__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!
http://auctions.yahoo.com
More information about the jdom-interest
mailing list