----- Original Message ----- From: "Brain, Jim" <[EMAIL PROTECTED]> > Why is it when I use detach, I have to do: > > Element el=doc.getRootElement(); > > return ((Element)((Node)el.detach()));
Or this would work... return (Element) doc.getRootElement().detach(); > > I though Element is a sub of Node. It is. So on any Node you can call detach() and it returns the node thats just been detached. http://dom4j.org/apidocs/org/dom4j/Node.html#detach() So that Node foo = ..; Node bar = foo.detach(); assert( foo == bar ); The main reason this is useful is that you can use this method when moving nodes from one place to another. For example Element destination = ...; Document temp = ...; // move the root node from temp document to // the new destination destination.add( temp.getRootElement().detach() ); James _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user
