in reply to Re: Lib::XML removing Node
in thread Lib::XML removing Node

thanks mate, that worked :D i'll try to modify your solution to delete all elements and delete one specific one, then i'll post it to other users :D thanks!!!!!!!

Replies are listed 'Best First'.
Re^3: Lib::XML removing Node
by Your Mother (Archbishop) on Jun 13, 2009 at 23:02 UTC

    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]; }
Re^3: Lib::XML removing Node
by smattiuz (Initiate) on Jun 17, 2009 at 13:13 UTC
    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!