[jdom-interest] problem with detaching Attributes in JDOM Beta 8, Release Candidate #1 ???

Jason Hunter jhunter at acm.org
Wed Mar 13 18:59:16 PST 2002


Please do two things.

First, run without the JIT so we can see line numbers in the trace.

Second, try to get this down to a reproducible test case.  It's always
easier to know you fixed something when you can see it break beforehand.

-jh-

Patrick McFarlane wrote:
> 
> Hello,
> 
>  I'm currently using code like the following to remove an attribute from one
> element and then add it to another.
> 
>                 Element currCompElem......
>                 Element refElem = ew.getReferencedElement();
>                 Attribute nameAttr = currCompElem.getAttribute("name");
>                 nameAttr.detach();
>                 refElem.setAttribute(nameAttr);
> 
>  I was able to use this code in JDOM Beta 7 without error. However with JDOM
> Beta 8 I get the following error...
> 
> java.lang.ExceptionInInitializerError: org.jdom.IllegalAddException: The
> attribute already has an existing parent "component"
>         at org.jdom.AttributeList.add(AttributeList.java, Compiled Code)
>         at org.jdom.AttributeList.add(AttributeList.java, Compiled Code)
>         at org.jdom.AttributeList.set(AttributeList.java:445)
>         at org.jdom.AttributeList.add(AttributeList.java, Compiled Code)
>         at org.jdom.Element.setAttribute(Element.java, Compiled Code)
>         at
> com.lendex.xml.templates.XMLTemplateObjectCreator.buildComponent(XMLTemplate
> ObjectCreator.java:195)
> 
> any ideas???
> 
> thanks,
>         patrick
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com



More information about the jdom-interest mailing list