Sorry about the post. You're exactly right about what was causing the exception. It had nothing to do with the remove.
"James Strachan" <[EMAIL PROTECTED]> wrote: I don't understand how calling parentElement.remove() can invoke the setRootElement() method on Document. Any chance you could show us a snippet of the code you're using, or maybe a full stack trace. From the stack trace you've provided it looks like you're trying to add an Element to a Document which is already connected to another Document - hence the exception. If you want to remove an Element from one document so that you can add it to another, use detach(). Document one = ...; DocumentFactory factory = new DocumentFactory(); Document two = factory.createDocument(); Element element = one.getRootElement(); // remove the root element of one and add it to two two.setRootElement( element.detach() ); James ------- http://radio.weblogs.com/0112098/ ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user