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];
}
| [reply] [d/l] |
yes! everything went good! i modified the code to delete last inserted items and all items older than the current date.
This all was for a university exam (HTML,CSS,XML,PERL,JAVASCRIPT), teacher gave me 28 out of 30 for my project (since it had a little issue with css in internet explorer!
Really appreciated all your help! | [reply] |