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

Patrick McFarlane PMcFarlane at lendx.com
Wed Mar 13 18:39:55 PST 2002


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



More information about the jdom-interest mailing list