Hi Peter,
I've applied your patch. Thanks! :-)
regards,
Maarten
Peter Schaefer schreef:
Hi all,
is this a bug or a feature?
public void testParentAfterSetContent() throws Exception {
Document doc = DocumentHelper.parseText("<root>" + "<a>a</a>"
+ "<b>b</b>" + "<x>x</x>" + "<d>d</d>" + "</root>");
Node x = doc.selectSingleNode("/root/x");
List content = doc.getRootElement().content();
int position = content.indexOf(x);
Element c = DocumentHelper.createElement("c");
c.setText("c");
content.add(position, c);
assertNotNull(c.getParent());
doc.getRootElement().setContent(content);
assertNotNull(c.getParent());
}
After setContent, the parent of c is null?!
If it is a bug, an easy patch in DefaultElement.setContent would be to
call contentRemoved() before all other stuff.
This doesn't seem to break other tests, but I am not familiar enough
with the dom4j-sources to evaluate other possible side-effects.
Please take a look at the attached patch.
cheers
Pete
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
dom4j-dev mailing list
dom4j-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-dev