hi,

I have a problem using dom4j to insert a new node into a specific position
in the tree.

This is because the insertBefore(Node newNode, Node refNode) is not defined
in com.dom4j.Node interface,
but only implemented in "org.dom4j.dom.DOMElement", which is derived from
"org.dom4j.tree.DefaultElement".


But the default implementation of dom4j seems to be creating DefaultElement
instead of DOMElement.
If you get an object from method like
                Element test = Element.clone()   or
                Element test = DOMDocument.getRootElement();

You can't cast test into DOMElement, because internally it is created as
DefultElement.
Therefore, you can't do a test.insertBefore(newNode, refNode) on test,
because inserBefore() is only supported in DOMElement level.


Anyone encounter similia problem and knows a way to round about this?


thx,
amber





_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to