I have a script which reads an excel file to change some parameters. This is my code:
#!/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);
}
}
}
The output XML Eats up some data:
This is my Original XML:
<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>
and it changes to this:
<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>
Dont know why this is happening. Can some one help. Let me know if some other information is required.