Sure thing. ikegami's suggestion is probably the most portable way to handle it too. It skips some of the node nonsense (naked text between elements are nodes|children too) and it is the way I usually do it in code. This would remove any after the first of a given TAGNAME.
my @nodes = $doc->findnodes("//TAGNAME"); if ( @nodes > 1 ) { $_->getParentNode->removeChild($_) for @nodes[1..$#nodes]; }
In reply to Re^3: Lib::XML removing Node
by Your Mother
in thread Lib::XML removing Node
by smattiuz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |