Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Using XML modules to remove XML elements

by gmpassos (Priest)
on Aug 05, 2004 at 21:23 UTC ( [id://380389]=note: print w/replies, xml ) Need Help??


in reply to Using XML modules to remove XML elements

use XML::Smart ; my $xml = new XML::Smart(q` <root> <journal> <full-title>Acta Biomaterialia</full-title> <alternate-title></alternate-title> <ISSN>1742-7061</ISSN> <E-ISSN></E-ISSN> <vol-year></vol-year> <iss-vol>1</iss-vol> <start-date>01-01-1974</start-date> <target> <siteID>1</siteID> <rank>200</rank> <activate></activate> </target> </journal> <journal> <full-title>Acta Biomaterialia</full-title> <alternate-title></alternate-title> <ISSN>1742-7062</ISSN> <E-ISSN></E-ISSN> <vol-year></vol-year> <iss-vol>1</iss-vol> <start-date>01-01-1974</start-date> <target> <siteID>1</siteID> <rank>200</rank> <activate></activate> </target> </journal> </root> `); my @jornals = @{ $xml->{root}{journal} } ; foreach my $jornals_i ( @jornals ) { if ( $jornals_i->{ISSN} eq '1742-7061' ) { my $i = $jornals_i->i() ; delete $xml->{root}{journal}[$i] ; } } print $xml->data ;

Graciliano M. P.
"Creativity is the expression of the liberty".

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://380389]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-19 18:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found