Perl XML :: Twig没有孩子的复制

时间:2016-06-29 09:04:04

标签: perl xml-twig

是否可以使用像

这样的东西
finally

没有复制孩子?我在page on CPAN上找不到任何关于它的内容。但也许我错过了什么?

1 个答案:

答案 0 :(得分:3)

没关系,我找到了办法。如果其他人寻找类似的东西,就把它留在这里。您所要做的就是使用cut_children。 我是这样做的:

my $nodeCopy = $node->copy();       #copy the node
$nodeCopy->paste('before', $node);  #paste the node
$node->cut_children();             #remove children from the original node