Re: the issue I was having with returning an element from a class through a
classloader, etc.
As James surmised, the classloader was not the issue.
The issue was:
I created a class T:
Class T
Element _e;
Element getE()
{ return _e; }
void setE(Element e) {
_e=e;
}
}
That did not work when I called getE to get the element, so I changed the
setE to be:
return e.detach();
that worked until I invoked the Class.forName to load the T class... I
thought.
So, I changed getE to be:
Document d=DocumentHelper.newDocument();
d.setRootElement(_e);
return d.getRootElement().detach()
which looked like it worked.
In any case, the classloader was just hiding the issue. The real issue was
that I was calling T.getE() in my test code, and the second call failed,
because _e had been attached to a document in the first part of my test. I
changed the code to be:
Element getE()
{ return e.createCopy("Name"); }
void setE(Element e)
{ _e=e.createCopy("name); }
Now, all works. Yay!
However, this brings up a couple of questions:
Since element subs fom Object, can't I use use clone()? Or, since there is
obviously a new API, why wasn;t clone overridden?
As well, is there a method on Element that is createCopy()? I want the same
localname (I think). Why do I need to give a new name?
Jim
Jim Brain, [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
"Researching tomorrow's decisions today."
(319) 369-2070 (work)
Systems Architect, Individual ITS, Life Investors Insurance Company of
America
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user