anshumangoyal has asked for the wisdom of the Perl Monks concerning the following question:
I have a script which reads an excel file to change some parameters. This is my code:
The output XML Eats up some data: This is my Original XML:#!/usr/bin/perl -w use strict; use XML::Twig; use Spreadsheet::XLSX; my $twig = XML::Twig->new; $twig->parsefile('ue_profile.xml'); my $workbook = Spreadsheet::XLSX->new('FSL_XML.xlsx'); for my $worksheet ( $workbook->worksheets() ) { my $worksheet_name = $worksheet->{Name}; my ( $row_min, $row_max ) = $worksheet->row_range(); my ( $col_min, $col_max ) = $worksheet->col_range(); for my $row ( $row_min + 1 .. $row_max ) { my @para_array; for my $col ( $col_min .. $col_max ) { my $cell = $worksheet->{Cells}[$row][$col]; my $cellValue = $cell->{Val}; if ($cellValue !~ /NA/i) { push (@para_array, $cellValue); } } my $value = pop(@para_array); my $Search_Key = join('/', @para_array); $Search_Key = "/".$Search_Key."/"; if ($Search_Key =~ m/cqiformatIndPeriodicSubbandK/i) { print "Hello"; } my (@model) = $twig->findnodes($Search_Key); foreach (@model) { $_->set_text($value); } } }
and it changes to this:<createUe> <!-- 0 = None , 1 = phyCqiReportingPeriodic , +2 = phyCqiReportingAperiodic, 3= Both --> <cqiReportingMode>0</cqiReportingMode> <!-- 0 to 4 --> <phyCqiReportingAperiodic>1</phyCqiReportingAp +eriodic> <!-- -1 to 6 --> <nomPdschRsEpreOffset>0 </nomPdschRsEpreOffset +> <phyCqiReportingPeriodic> <!-- 0 = release , 1 = setup --> <cqiReportingPeriodicMode>0</cqiReportingP +eriodicMode> <!-- 0 to 1185 --> <cqiPucchResourceIndex>0 </cqiPucchResourc +eIndex> <!-- 0 to 1023 --> <cqiPmiConfigIndex> 25 </cqiPmiConfigIndex +> <!-- 0 = wideBand 1 = subBand --> <cqiSubBandWideBandChoice>1</cqiSubBandWid +eBandChoice> <!-- Optional --> <!-- 1 to 4 --> <cqiformatIndPeriodicSubbandK>3</cqiformat +IndPeriodicSubbandK> <!-- Optional --> <!-- 0 to 1023 --> <riConfigIndex>483 </riConfigIndex> <!-- 0 or 1 --> <simultaneousAckNackAndCQI>0 </simultaneou +sAckNackAndCQI> </phyCqiReportingPeriodic> </createUe>
Dont know why this is happening. Can some one help. Let me know if some other information is required.<createUe> <!-- 0 = None , 1 = phyCqiReportingPeriodic , 2 = phyCqiReport +ingAperiodic, 3= Both --> <cqiReportingMode>1187</cqiReportingMode> <!-- 0 to 4 --> <phyCqiReportingAperiodic>1189</phyCqiReportingAperiodic> <!-- -1 to 6 --> <nomPdschRsEpreOffset>1188</nomPdschRsEpreOffset> <phyCqiReportingPeriodic>1196</phyCqiReportingPeriodic> </createUe>
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: XML::Twig Eating Up Data
by Don Coyote (Hermit) on Nov 03, 2012 at 19:35 UTC | |
by anshumangoyal (Scribe) on Nov 07, 2012 at 05:38 UTC | |
Re: XML::Twig Eating Up Data
by mirod (Canon) on Nov 05, 2012 at 12:38 UTC |
Back to
Seekers of Perl Wisdom