GI-eSTB-MIB-NPH::eSTBUserSettingOutput.0 = INTEGER: hd1920x1080i(1)
GI-eSTB-MIB-NPH::eSTBUserSetting43OverRide.0 = INTEGER: on480p(3)
####
#!/usr/bin/perl
use strict;
use warnings;
use XML::Writer;
my $out;
my $xml = XML::Writer->new(OUTPUT => \$out, DATA_MODE => 1, DATA_INDENT => ' ');
$xml->xmlDecl();
$xml->startTag('doc');
my $check_1 = 0;
open(my $fh, "<", "/home/drone/DrumTesting/Test.txt")
or die "Failed to open file: $!\n";
while(<$fh>) {
chomp;
next if !length;
my ($string1, $string2, $subscript_name, $subscript_value) = /
^([^\::]+)
([^\s]+)
\.([^\s]+)
\s(.*)
/x;
if ( $check_1 == 0 ) {
$xml->startTag($string1);
$check_1 += 1;
}
$xml->startTag($string2);
$xml->dataElement($subscript_name => $subscript_value);
$xml->endTag();
}
$xml->endTag();
$xml->endTag();
$xml->end();
print $out;
close $fh;
####
<::eSTBUserSettingOutput>
<0>= INTEGER: hd1920x1080i(1)0>
<::eSTBUserSetting43OverRide>
<0>= INTEGER: on480p(3)0>
####
^([^\::]+)
(/::(\[a-zA-Z]+)\./)
\.([^\s]+)
\s(.*)