Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.5.1
-
None
-
None
Description
I haven't found docs about removing groovy.util.Node but this seems kind of wrong. I can remove a node but the parent of this node is still the old parent.
def xml = ''' <foo> <bar id="1" /> <bar id="2" /> <bar id="3" /> </foo>''' Node foo = new XmlParser().parseText(xml) assert foo.bar.size() == 3 Node bar2 = foo.bar.find {it.@id == '2'} bar2.parent().children().remove(bar2) assert foo.bar.size() == 2 assert ! foo.bar.contains(bar2) assert bar2.parent() == null // this fails