in reply to Extract Data from XML (unique xml format?)
Output using your example XML:use XML::LibXML; my $doc = XML::LibXML->load_xml(string => $xml); my @mds = $doc->findnodes('//md'); for my $md ( @mds ) { my @mts = $md->findnodes('mi/mt'); next unless @mts; my @rs = $md->findnodes('mi/mv/r'); for my $i ( 0 .. $#mts ) { my ( $mt, $r ) = ( $mts[$i], $rs[$i] ); print "mt: ", $mt->textContent, "\n"; print "r: ", $r->textContent, "\n\n"; } }
mt: pmPdcpPktDiscDlEth r: 0 mt: pmLicDlCapActual r: 0 mt: pmLicUlCapActual r: 0 mt: pmLicDlPrbCapActual r: 0 mt: pmLicUlPrbCapActual r: 0 mt: pmPdcpPktDiscDlEth r: 0 mt: pmPdcpPktDiscUlEthPacing r: 0 mt: pmLicDlCapDistr r: 81893,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 mt: pmLicUlCapDistr r: 90083,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 mt: pmLicDlPrbCapDistr r: 81893,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 mt: pmLicUlPrbCapDistr r: 90083,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Extract Data from XML (unique xml format?)
by AjitKhodke (Initiate) on Jun 17, 2015 at 05:44 UTC | |
by clapeters (Initiate) on Jun 23, 2015 at 16:24 UTC | |
|
Re^2: Extract Data from XML (unique xml format?)
by clapeters (Initiate) on Jun 23, 2015 at 16:22 UTC | |
|
Re^2: Extract Data from XML (unique xml format?)
by locked_user sundialsvc4 (Abbot) on Jun 16, 2015 at 21:52 UTC | |
by Anonymous Monk on Jun 16, 2015 at 23:24 UTC |