aryapintu has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Need to convert the XML into file
by kcott (Archbishop) on Aug 25, 2016 at 07:23 UTC
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Need to convert the XML into file
by Anonymous Monk on Aug 25, 2016 at 07:41 UTC
Re: Need to convert the XML into file
by aryapintu (Initiate) on Aug 25, 2016 at 08:39 UTC
    sub get4Gdata { my( $doc, $filename, $tarrecordNumber, $filesubdirIndex, $pmlinehead +er) = @_; #I need the below XML in a format #plmnId=26290,HenBId=768012,crnti=132,srbId=1 #VS.numberOfDlSrbSduReceived 53 #VS.numberOfDlSrbPduTransmitted 53 #plmnId=26290,HenBId=768012,crnti=132,srbId=2 #VS.numberOfDlSrbSduReceived 30 #VS.numberOfDlSrbPduTransmitted 30 # # #<mi> # <mt>VS.numberOfDlSrbSduReceived</mt> # <mt>VS.numberOfDlSrbPduTransmitted</mt> # <mv> # <moid>plmnId=26290,HenBId=768012,crnti=132,srbId=1</moid> # <r>53</r> # <r>53</r> # </mv> # <mv> # <moid>plmnId=26290,HenBId=768012,crnti=132,srbId=2</moid> # <r>30</r> # <r>30</r> # </mv> #</mi> my @milist = $doc->getElementsByTagName('mi'); foreach my $mi (@milist) { my $miname = $mi; my @moidlist = $mi->getElementsByTagName('moid'); foreach my $moid (@moidlist) { my $moidname = $moid->firstChild()->nodeValue(); $moidname =~ s/ //g; $moidname =~ s/\n//g; $moidname =~ s/\r//g; print " ", $moid->getName(), " ", $moid->nodePath(), " ", $moidna +me, "\n"; my @mtlist = $mi->getElementsByTagName('mt'); foreach my $mt (@mtlist) { my $mtname = $mt->firstChild()->nodeValue(); #my $mtvname = $mi->getElementsByTagName('r'); $mtname =~ s/ //g; $mtname =~ s/\n//g; $mtname =~ s/\r//g; print " ", $mt->getName(), " ", $mt->nodePath(), " ", $mtn +ame, "\n"; #my @mtvvalue = $mi->getElementsByTagName('r'); #foreach my $r (@mtvvalue) { #my $mtvname = $mi->getElementsByTagName('r'); #my $mtvname = $r->firstChild()->nodeValue(); #print " ", $r->getName(), " ", $r->nodePath(), " ", $mtvn +ame, "\n"; #print $mtvname, "\n"; # print " ", $rlistname->getName(), " ", $rlistname->nodePa +th(), " ", $rlistname, , "\n"; #===================================================================== +======================= } } } } }