[jdom-interest] Element setAttribute

guru at stinky.com guru at stinky.com
Mon Jun 18 09:37:11 PDT 2001


It's in beta 7.  Download the latest CVS build and try it out.

It actually works slightly differently than yours -- instead of
reaching in and changing the value of the existing attribute, it just
detaches it and adds the new one.  It also deals with Namespaces.

Usage:  element.setAttribute(new Attribute("foo", "bar"));

 - A

On Mon, Jun 18, 2001 at 12:45:44PM +0200, Martin Gerlach wrote:
> Hi 
> 
> i'm missing a/the method to set an attribute for an element.
> It should work like:
> 
> public void setAttribute(String attrName, String attrValue) {
> 	Attribute attr = getAttribute(attrName);
> 	if(attr != null) {
> 		attr.setValue(attrValue);
> 		return;
> 	}
> 	addAttribute(attrName, attrValue);
> }
> 
> Or why isn't it implemented or won't implemented ?
> 
> Thanks for any reply.
> 
> -- 
> _______________________________________________________________
> 
>     Martin Gerlach                Distributed Systems
>     
>     phone: +49 (0)221 250-1046    mailto:gerlach at imigo.de
>     fax:   +49 (0)221 250-1588    http://www.planb-media.de
>     
>     plan_b media AG               Coloneum
>     Butzweilerstr. 255            D-50829 Cologne, Germany
> _______________________________________________________________
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

-- 
Alex Chaffee                       mailto:alex at jguru.com
jGuru - Java News and FAQs         http://www.jguru.com/alex/
Creator of Gamelan                 http://www.gamelan.com/
Founder of Purple Technology       http://www.purpletech.com/
Curator of Stinky Art Collective   http://www.stinky.com/



More information about the jdom-interest mailing list