From: "Soumanjoy Das" <[EMAIL PROTECTED]>
> Hi Christian,
>
> I just tried out your suggestion:
>
> I created an element and immediately printed the contents of the Document,
>
> oChild = oDocument.createElement("Guest");
> System.out.println(oDocument.asXML());
>
> The output did not show the new element. So DocumentHelper.createElement()
> and DOMDocument.createElement() are equivalent, in the sense that when a
new
> element is created, it is 'floating' and does not have any position in the
> XML document.
>
> In fact, when I tried to invoke the oChild.getParentNode()
> before appending it to the document, there was an error:
> org.w3c.dom.DOMException: Not supported yet


Do you have some source code for this then we can add it to the unit test
cases?


> Which means that the 'newborn' node doesn't have a parent yet.

A node only gets a parent when it is actually added to an element or
document.


> If this is
> the case, then I think even you'll agree that insertBefore() must have
> something wrong with it, if it always inserts a node at the top
(beginning)
> of the document.

Agreed. I've fixed a bug in insertBefore() (which is in CVS and the daily
build right now) such that if the node you're trying to insert before is not
found, then the new node is added at the end of the list.

This should fix any wierdness. Though you should figure out why the node
you're trying to insert before could not be found. I suspect the node you're
trying to insert before couldn't be found.

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

Reply via email to