R
robic0
This post is in response to someone who asked for help trying to
parse xml into a data structure. The poster couldn't install
XML:
arser or XML::Simple. I replied a few times with some
partial code. Good to my word, here is the core of a cut & paste
non-Perl-module based, raw, robust data xml parser into Perl
data structures. Its about 140 lines of code. I imagine its
about 3 times faster than the XML parsers out there, didn't time
it. It doesen't use the overhead of SAX or nodes.
This installment is released prematurely without the fancy
XML::Simple options yet. This is a typical "force array"
version (see the sub's below). I wanted to wait until tommorow
to post this but, I already know how to do it but don't have the
time tonight, however this is fairly final, and so I release
it with the understanding that its shortcomings will be fixed
in a day or so.
I've spent 4 days on this. You have to read between the lines
to insert your xml file open or just cut and paste your xml
to $gabage1. I've left that part up to you. The output
and data are legitimate. It won't look like XML:Simple
in the default settings. I maintaine a root here and some other
things. However, I will post a mod tommorow. The output and
parsing is completely legitimate. The parsing is probably
much faster than the modules on CPAN.
Let me know if you have any suggestions for improvement.
I want to keep it under 200 lines for a complete cut & paste
solution. It doesen't use any parser out there. Its parser
is built in. I don't think this method is used anywhere
in the XML world, you may want to check for possible multiple
speed enhancement.
Posting changes tommorow on this.
Contact info:
email: robic0-AT-yahoo.com
========================================================
use strict;
use warnings;
use Data:
umper;
open DATA "datafile" or die "can't open datafile...";
my $gabage1 = <DATA>;
close DATA;
my @xml_files = ($gabage1);
my $debug = 0;
my $rmv_white_space = 1;
## -- XML start & end regexp substitution delimeter chars --
## match side , substitution side
## -----------------------/-------------------------
my @S_dlim = ('\[' , '['); # use these for reading (debug)
my @E_dlim = ('\]' , ']');
#my @S_dlim = (chr(140) , chr(140)); # use these for production
#my @E_dlim = (chr(141) , chr(141));
for (@xml_files)
{
if ($rmv_white_space) {
s/>[\s]+</></g;
s/[\s]+</</g;
s/>[\s]+/>/g;
}
print "\n",'='x30,"\n$_\n\n" if ($debug);
my $ROOT = {}; # container
my ($last_cnt, $cnt, $i) = (-1, 1, 0);
# should only need 2 iterations max, but wth
while ($cnt != $last_cnt && $i < 20)
{
$last_cnt = $cnt;
## <?XML-Version ?> , have to check the format of '<?'
while (s/<\?([^<>]*)\?>//i) {} # to void xml
versioning
# while (s/<\?([^<>]*)\?>/$S_dlim[1]$cnt$E_dlim[1]/i) {
print "$cnt <$1> = \n" if ($debug); $cnt++}
## <!-- Comments -->
# while (s/<!--([^<>]*)-->//i) {} # to void comments
while (s/<!--([^<>]*)-->/$S_dlim[1]$cnt$E_dlim[1]/i) {
print "$cnt <!-- --> = $1\n" if ($debug);
$ROOT->{$cnt} = { comment => $1 };
$cnt++;
}
# Comments, need to have "anything but <!-- nor -->
here" (revisit)
# while
(s/<!--([^(<!--)^(-->)]*)-->/$S_dlim[1]$cnt$E_dlim[1]/i) { print "$cnt
<!-- --> = $1\n" if ($debug); $cnt++}
## <Tag/> , no content
while
(s/<([0-9a-zA-Z]+)\/>/$S_dlim[1]$cnt$E_dlim[1]/i) {
print "$cnt <$1> = \n" if ($debug);
$ROOT->{$cnt} = { $1 => '' };
$cnt++;
}
## <Tag Attributes/> , no content
while (s/<([0-9a-zA-Z]+)([ ]+[0-9a-zA-Z]+[ ]*=[
]*"[^<]*")+[ ]*\/>/$S_dlim[1]$cnt$E_dlim[1]/i) {
print "$cnt <$1> = attr: $2\n" if ($debug);
$ROOT->{$cnt} = { $1 => getAttrHash($2) };
$cnt++;
}
## <Tag> Content </Tag>
while
(s/<([0-9a-zA-Z]+)>([^<]*)<\/\1>/$S_dlim[1]$cnt$E_dlim[1]/i) {
print "$cnt <$1> = $2\n" if ($debug);
my $unknown = '';
if (length($2) > 0) {
my ($key); my $hcontent =
getContentHash($2, $ROOT);
if (keys (%{$hcontent}) > 1) {
$unknown = $hcontent;
}
else { ($key,$unknown) = each
(%{$hcontent}); }
}
$ROOT->{$cnt} = { $1 => $unknown };
$cnt++;
}
## <Tag Attributes> Content </Tag>
while (s/<([0-9a-zA-Z]+)([ ]+[0-9a-zA-Z]+[ ]*=[
]*"[^<]*")+[ ]*>([^<]*)<\/\1>/$S_dlim[1]$cnt$E_dlim[1]/i) {
print "$cnt <$1> = attr: $2, content: $3\n" if
($debug);
my $hattrib = getAttrHash($2);
my $hcontent = getContentHash($3, $ROOT);
while (my ($key,$val) = each (%{$hcontent})) {
$hattrib->{$key} = $val;
}
$ROOT->{$cnt} = { $1 => $hattrib };
$cnt++;
}
$i++ if ($last_cnt != $cnt);
}
if (/<|>/) {
print "($i) XML problem, malformed, syntax or tag
closure:\n$_";
} else {
print "$i itterations\n\n";
#print Dumper($ROOT);
my $outer_element = $cnt-1;
if (exists $ROOT->{$outer_element}) {
my $tmp = {};
%{$tmp} = %{$ROOT->{$outer_element}};
print Dumper($tmp);
}
}
}
##
sub getAttrHash
{
my $attstr = shift;
my $ahref = {};
return $ahref unless (defined $attstr);
while ($attstr =~ s/[ ]*([0-9a-zA-Z]+)[ ]*=[ ]*"([^=]*)"[
]*//i) {
$ahref->{$1} = $2;
}
return $ahref;
}
##
sub getContentHash
{
my ($attstr,$hStore) = @_;
my $ahref = {};
return $ahref unless (defined $attstr && defined $hStore);
my @ary = ();
while ($attstr =~
s/([^<$S_dlim[0]$E_dlim[0]]+)|$S_dlim[0]([\d]+)$E_dlim[0]//i) {
if (defined $1) {
push (@ary, $1);
}
elsif (defined $2 && exists $hStore->{$2}) {
my ($key,$val) = each (%{$hStore->{$2}});
# here, force array is in effect (aka: simple)
# (this will be modified in a day or so)
################
if (exists $ahref->{$key})
{
#print "getChash - $key\n";
push (@{$ahref->{$key}}, $val);
} else {
$ahref->{$key} = [$val];
# $ahref->{$key} = $val;
}
################
}
}
if (scalar(@ary) == 1) {
$ahref->{'content'} = $ary[0];
} elsif (scalar(@ary) > 1) {
$ahref->{'content'} = [@ary];
}
return $ahref;
}
__END__
$VAR1 = {
'document' => {
'WMSNameSpaceVersion' => '2.0',
'comment' => [
' Control Protocol ',
' Data Protocol ',
' Feedback Protocol ',
' Network Source '
],
'node' => [
{
'opcode' => 'create',
'comment' => [
' Object Store
'
],
'name' => 'Control Protocol',
'node' => [
{
'opcode' =>
'create',
'comment' => [
'
RTSP ',
'
Sessionless Multicast '
],
'name' =>
'Object Store',
'node' => [
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'RTSP',
'node' => [
{
'opcode' => 'create',
'value' => '{308786f0-8b15-11d2-b25f-006097d2e41e}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'RTSP,RTSPA,RTSPT,RTSPU,RTSPM',
'name' => 'Protocol',
'type' => 'string'
}
]
}
]
},
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'Sessionless Multicast',
'node' => [
{
'opcode' => 'create',
'value' => '{f9377800-f38d-11d2-b26c-006097d2e41e}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'MCAST,RTP',
'name' => 'Protocol',
'type' => 'string'
}
]
}
]
}
]
},
{
'opcode' =>
'create',
'name' =>
'Shared Properties'
}
]
},
{
'opcode' => 'create',
'comment' => [
' Object Store
'
],
'name' => 'Data Protocol',
'node' => [
{
'opcode' =>
'create',
'comment' => [
'
RTP ',
'
RTP/ASF ',
'
RTP/AVP ',
'
RTP/FEC ',
'
RTP/WMS-FEC '
],
'name' =>
'Object Store',
'node' => [
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'RTP',
'node' => [
{
'opcode' => 'create',
'value' => '{cbfb2e20-ab7b-11d2-b261-006097d2e41e}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'x-asf-pf',
'name' => 'Format',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => 'RTP/AVP',
'name' => 'Protocol',
'type' => 'string'
}
]
}
]
},
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'RTP/ASF',
'node' => [
{
'opcode' => 'create',
'value' => '{149a44be-dc14-4e94-9cb0-c0268e77df9e}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'x-asfv2-pf,x-asfv2-grp-pf,x-asfv2-frag-pf',
'name' => 'Format',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => 'RTP/AVP',
'name' => 'Protocol',
'type' => 'string'
}
]
}
]
},
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'RTP/AVP',
'node' => [
{
'opcode' => 'create',
'value' => '{d7335e2e-62eb-4ad0-96cd-b31c9d0f9f85}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'PCMU,L8,L16,MPA,G726-24,G726-40',
'name' => 'Format',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => 'RTP/AVP',
'name' => 'Protocol',
'type' => 'string'
}
]
}
]
},
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'RTP/FEC',
'node' => [
{
'opcode' => 'create',
'value' => '{02DEFE42-F8FC-11d2-8670-00C04F6890ED}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'parityfec',
'name' => 'Format',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => 'RTP/AVP',
'name' => 'Protocol',
'type' => 'string'
}
]
}
]
},
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'RTP/WMS-FEC',
'node' => [
{
'opcode' => 'create',
'value' => '{EDAB8E6B-746C-40db-A885-9E4A9EEF27A2}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'wms-fec',
'name' => 'Format',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => 'RTP/AVP',
'name' => 'Protocol',
'type' => 'string'
}
]
}
]
}
]
},
{
'opcode' =>
'create',
'name' =>
'Shared Properties'
}
]
},
{
'opcode' => 'create',
'comment' => [
' Object Store
'
],
'name' => 'Feedback Protocol',
'node' => [
{
'opcode' =>
'create',
'comment' => [
'
RTCP '
],
'name' =>
'Object Store',
'node' => [
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'RTCP',
'node' => [
{
'opcode' => 'create',
'value' => '{ecfddc81-184e-11d3-ae84-00a0c95ec3f0}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'x-wms-rtx',
'name' => 'Format',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => 'RTP/AVP',
'name' => 'Protocol',
'type' => 'string'
}
]
}
]
}
]
},
{
'opcode' =>
'create',
'name' =>
'Shared Properties'
}
]
},
{
'opcode' => 'create',
'comment' => [
' Object Store
',
' Shared
Properties '
],
'name' => 'Network Source',
'node' => [
{
'opcode' =>
'create',
'comment' => [
'
WMS Http Network Source ',
'
WMS Mms Network Source ',
'
WMS Msbd Network Source ',
'
WMS Network Source '
],
'name' =>
'Object Store',
'node' => [
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'WMS Http Network Source',
'node' => [
{
'opcode' => 'create',
'value' => '{566A2EFF-5651-4020-AC1A-EB48E4571EA3}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'HTTP',
'name' => 'Source Type',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x50',
'name' => 'DefaultHttpServerPort',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x1bb',
'name' => 'DefaultHttpServerSSLPort',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x8',
'name' => 'PacketBuffers',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'EnableHTTP1_1',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x1e',
'name' => 'OpenTimeout',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x64',
'name' => 'SecondSegmentTimeout',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '',
'name' => 'ControlAdapter',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x55',
'name' => 'PercentBWUsageForAccelStreaming',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x3',
'name' => 'Proxy Setting',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '',
'name' => 'ProxyHostName',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x50',
'name' => 'ProxyPort',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'ProxyBypassForLocal',
'type' => 'int32'
}
]
}
]
},
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'WMS Mms Network Source',
'node' => [
{
'opcode' => 'create',
'value' => '{DCF6C8B2-F6C0-461b-82DA-35945EADF54A}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'MMS,MMST,MMSU',
'name' => 'Source Type',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x6db',
'name' => 'DefaultServerPort',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x4',
'name' => 'MaxReadHeaderRetries',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x8',
'name' => 'PacketBuffers',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'DropProb',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'DropGracePeriod',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'FirstDropGracePeriod',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'DropBurstDuration',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'PacketPairDropProb',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x2',
'name' => 'NackAlgorithm',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'NackRateMultiplier',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x5dc',
'name' => 'NackBurst',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x3e8',
'name' => 'NackTraceInterval',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'NackRetry',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'IgnoreServerVersion',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'EnableMmsDistribution',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'AssertStrangeErrors',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x5a',
'name' => 'InactivityTimeout',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x20',
'name' => 'OpenTimeout',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x55',
'name' => 'PercentBWUsageForAccelStreaming',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '',
'name' => 'FunnelAdapter',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '',
'name' => 'ControlAdapter',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'Proxy Setting',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '',
'name' => 'ProxyHostName',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x6db',
'name' => 'ProxyPort',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'ProxyBypassForLocal',
'type' => 'int32'
}
]
}
]
},
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'WMS Msbd Network Source',
'node' => [
{
'opcode' => 'create',
'value' => '{FB74F625-7D25-4455-B840-7B870B5B9322}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'ASFM',
'name' => 'Source Type',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x8',
'name' => 'PacketBuffers',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'DropProb',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'DropGracePeriod',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'FirstDropGracePeriod',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'DropBurstDuration',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x3a98',
'name' => 'McastTimeout',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'EnableIGMPv3',
'type' => 'int32'
}
]
}
]
},
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'WMS Network Source',
'node' => [
{
'opcode' => 'create',
'value' => '{ad763fa6-3b90-41ab-bd44-4f832beee55f}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'RTSP,XSDP,RTP,RTSPA,RTSPT,RTSPU,RTSPM',
'name' => 'Source Type',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'EnableATM',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'MaximumMTU',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x14',
'name' => 'FirewallTimeout',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x1e',
'name' => 'OpenTimeout',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'RtxDropProb',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'DropProb',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'DropGracePeriod',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'FirstDropGracePeriod',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'DropBurstDuration',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'PacketPairDropProb',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x2',
'name' => 'NackAlgorithm',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'NackRateMultiplier',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x5dc',
'name' => 'NackBurst',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x3e8',
'name' => 'NackTraceInterval',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'NackRetry',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'BurstProtection',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'EmulateNetworkDisconnect',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'AssertStrangeErrors',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x55',
'name' => 'PercentBWUsageForAccelStreaming',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'Proxy Setting',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '',
'name' => 'ProxyHostName',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x22a',
'name' => 'ProxyPort',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'ProxyBypassForLocal',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x3e8',
'name' => 'PktGracePeriodAtEOSForBPP',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x9c4',
'name' => 'PktGracePeriodAtEOSForODP',
'type' => 'int32'
}
]
}
]
}
]
},
{
'opcode' =>
'create',
'name' =>
'Shared Properties',
'node' => [
{
'opcode' => 'create',
'name' => 'Local'
}
]
}
]
}
]
}
};
__DATA__
<document WMSNameSpaceVersion="2.0">
<node name="Control Protocol" opcode="create" >
<node name="Object Store" opcode="create" >
<node name="RTSP" opcode="create" >
<node name="CLSID" opcode="create" type="string"
value="{308786f0-8b15-11d2-b25f-006097d2e41e}" />
<node name="Enabled" opcode="create" type="int32" value="0x1"
/>
<node name="Properties" opcode="create" >
<node name="Protocol" opcode="create" type="string"
value="RTSP,RTSPA,RTSPT,RTSPU,RTSPM" />
</node> <!-- Properties -->
</node> <!-- RTSP -->
<node name="Sessionless Multicast" opcode="create" >
<node name="CLSID" opcode="create" type="string"
value="{f9377800-f38d-11d2-b26c-006097d2e41e}" />
<node name="Enabled" opcode="create" type="int32" value="0x1"
/>
<node name="Properties" opcode="create" >
<node name="Protocol" opcode="create" type="string"
value="MCAST,RTP" />
</node> <!-- Properties -->
</node> <!-- Sessionless Multicast -->
</node> <!-- Object Store -->
<node name="Shared Properties" opcode="create" />
</node> <!-- Control Protocol -->
<node name="Data Protocol" opcode="create" >
<node name="Object Store" opcode="create" >
<node name="RTP" opcode="create" >
<node name="CLSID" opcode="create" type="string"
value="{cbfb2e20-ab7b-11d2-b261-006097d2e41e}" />
<node name="Enabled" opcode="create" type="int32" value="0x1"
/>
<node name="Properties" opcode="create" >
<node name="Format" opcode="create" type="string"
value="x-asf-pf" />
<node name="Protocol" opcode="create" type="string"
value="RTP/AVP" />
</node> <!-- Properties -->
</node> <!-- RTP -->
<node name="RTP/ASF" opcode="create" >
<node name="CLSID" opcode="create" type="string"
value="{149a44be-dc14-4e94-9cb0-c0268e77df9e}" />
<node name="Enabled" opcode="create" type="int32" value="0x1"
/>
<node name="Properties" opcode="create" >
<node name="Format" opcode="create" type="string"
value="x-asfv2-pf,x-asfv2-grp-pf,x-asfv2-frag-pf" />
<node name="Protocol" opcode="create" type="string"
value="RTP/AVP" />
</node> <!-- Properties -->
</node> <!-- RTP/ASF -->
<node name="RTP/AVP" opcode="create" >
<node name="CLSID" opcode="create" type="string"
value="{d7335e2e-62eb-4ad0-96cd-b31c9d0f9f85}" />
<node name="Enabled" opcode="create" type="int32" value="0x1"
/>
<node name="Properties" opcode="create" >
<node name="Format" opcode="create" type="string"
value="PCMU,L8,L16,MPA,G726-24,G726-40" />
<node name="Protocol" opcode="create" type="string"
value="RTP/AVP" />
</node> <!-- Properties -->
</node> <!-- RTP/AVP -->
<node name="RTP/FEC" opcode="create" >
<node name="CLSID" opcode="create" type="string"
value="{02DEFE42-F8FC-11d2-8670-00C04F6890ED}" />
<node name="Enabled" opcode="create" type="int32" value="0x1"
/>
<node name="Properties" opcode="create" >
<node name="Format" opcode="create" type="string"
value="parityfec" />
<node name="Protocol" opcode="create" type="string"
value="RTP/AVP" />
</node> <!-- Properties -->
</node> <!-- RTP/FEC -->
<node name="RTP/WMS-FEC" opcode="create" >
<node name="CLSID" opcode="create" type="string"
value="{EDAB8E6B-746C-40db-A885-9E4A9EEF27A2}" />
<node name="Enabled" opcode="create" type="int32" value="0x1"
/>
<node name="Properties" opcode="create" >
<node name="Format" opcode="create" type="string"
value="wms-fec" />
<node name="Protocol" opcode="create" type="string"
value="RTP/AVP" />
</node> <!-- Properties -->
</node> <!-- RTP/WMS-FEC -->
</node> <!-- Object Store -->
<node name="Shared Properties" opcode="create" />
</node> <!-- Data Protocol -->
<node name="Feedback Protocol" opcode="create" >
<node name="Object Store" opcode="create" >
<node name="RTCP" opcode="create" >
<node name="CLSID" opcode="create" type="string"
value="{ecfddc81-184e-11d3-ae84-00a0c95ec3f0}" />
<node name="Enabled" opcode="create" type="int32" value="0x1"
/>
<node name="Properties" opcode="create" >
<node name="Format" opcode="create" type="string"
value="x-wms-rtx" />
<node name="Protocol" opcode="create" type="string"
value="RTP/AVP" />
</node> <!-- Properties -->
</node> <!-- RTCP -->
</node> <!-- Object Store -->
<node name="Shared Properties" opcode="create" />
</node> <!-- Feedback Protocol -->
<node name="Network Source" opcode="create" >
<node name="Object Store" opcode="create" >
<node name="WMS Http Network Source" opcode="create" >
<node name="CLSID" opcode="create" type="string"
value="{566A2EFF-5651-4020-AC1A-EB48E4571EA3}" />
<node name="Enabled" opcode="create" type="int32" value="0x1"
/>
<node name="Properties" opcode="create" >
<node name="Source Type" opcode="create" type="string"
value="HTTP" />
<node name="DefaultHttpServerPort" opcode="create"
type="int32" value="0x50" />
<node name="DefaultHttpServerSSLPort" opcode="create"
type="int32" value="0x1bb" />
<node name="PacketBuffers" opcode="create" type="int32"
value="0x8" />
<node name="EnableHTTP1_1" opcode="create" type="int32"
value="0x1" />
<node name="OpenTimeout" opcode="create" type="int32"
value="0x1e" />
<node name="SecondSegmentTimeout" opcode="create"
type="int32" value="0x64" />
<node name="ControlAdapter" opcode="create" type="string"
value="" />
<node name="PercentBWUsageForAccelStreaming" opcode="create"
type="int32" value="0x55" />
<node name="Proxy Setting" opcode="create" type="int32"
value="0x3" />
<node name="ProxyHostName" opcode="create" type="string"
value="" />
<node name="ProxyPort" opcode="create" type="int32"
value="0x50" />
<node name="ProxyBypassForLocal" opcode="create"
type="int32" value="0x0" />
</node> <!-- Properties -->
</node> <!-- WMS Http Network Source -->
<node name="WMS Mms Network Source" opcode="create" >
<node name="CLSID" opcode="create" type="string"
value="{DCF6C8B2-F6C0-461b-82DA-35945EADF54A}" />
<node name="Enabled" opcode="create" type="int32" value="0x1"
/>
<node name="Properties" opcode="create" >
<node name="Source Type" opcode="create" type="string"
value="MMS,MMST,MMSU" />
<node name="DefaultServerPort" opcode="create" type="int32"
value="0x6db" />
<node name="MaxReadHeaderRetries" opcode="create"
type="int32" value="0x4" />
<node name="PacketBuffers" opcode="create" type="int32"
value="0x8" />
<node name="DropProb" opcode="create" type="int32"
value="0x0" />
<node name="DropGracePeriod" opcode="create" type="int32"
value="0x0" />
<node name="FirstDropGracePeriod" opcode="create"
type="int32" value="0x0" />
<node name="DropBurstDuration" opcode="create" type="int32"
value="0x0" />
<node name="PacketPairDropProb" opcode="create" type="int32"
value="0x0" />
<node name="NackAlgorithm" opcode="create" type="int32"
value="0x2" />
<node name="NackRateMultiplier" opcode="create" type="int32"
value="0x1" />
<node name="NackBurst" opcode="create" type="int32"
value="0x5dc" />
<node name="NackTraceInterval" opcode="create" type="int32"
value="0x3e8" />
<node name="NackRetry" opcode="create" type="int32"
value="0x1" />
<node name="IgnoreServerVersion" opcode="create"
type="int32" value="0x0" />
<node name="EnableMmsDistribution" opcode="create"
type="int32" value="0x0" />
<node name="AssertStrangeErrors" opcode="create"
type="int32" value="0x0" />
<node name="InactivityTimeout" opcode="create" type="int32"
value="0x5a" />
<node name="OpenTimeout" opcode="create" type="int32"
value="0x20" />
<node name="PercentBWUsageForAccelStreaming" opcode="create"
type="int32" value="0x55" />
<node name="FunnelAdapter" opcode="create" type="string"
value="" />
<node name="ControlAdapter" opcode="create" type="string"
value="" />
<node name="Proxy Setting" opcode="create" type="int32"
value="0x0" />
<node name="ProxyHostName" opcode="create" type="string"
value="" />
<node name="ProxyPort" opcode="create" type="int32"
value="0x6db" />
<node name="ProxyBypassForLocal" opcode="create"
type="int32" value="0x0" />
</node> <!-- Properties -->
parse xml into a data structure. The poster couldn't install
XML:
partial code. Good to my word, here is the core of a cut & paste
non-Perl-module based, raw, robust data xml parser into Perl
data structures. Its about 140 lines of code. I imagine its
about 3 times faster than the XML parsers out there, didn't time
it. It doesen't use the overhead of SAX or nodes.
This installment is released prematurely without the fancy
XML::Simple options yet. This is a typical "force array"
version (see the sub's below). I wanted to wait until tommorow
to post this but, I already know how to do it but don't have the
time tonight, however this is fairly final, and so I release
it with the understanding that its shortcomings will be fixed
in a day or so.
I've spent 4 days on this. You have to read between the lines
to insert your xml file open or just cut and paste your xml
to $gabage1. I've left that part up to you. The output
and data are legitimate. It won't look like XML:Simple
in the default settings. I maintaine a root here and some other
things. However, I will post a mod tommorow. The output and
parsing is completely legitimate. The parsing is probably
much faster than the modules on CPAN.
Let me know if you have any suggestions for improvement.
I want to keep it under 200 lines for a complete cut & paste
solution. It doesen't use any parser out there. Its parser
is built in. I don't think this method is used anywhere
in the XML world, you may want to check for possible multiple
speed enhancement.
Posting changes tommorow on this.
Contact info:
email: robic0-AT-yahoo.com
========================================================
use strict;
use warnings;
use Data:
open DATA "datafile" or die "can't open datafile...";
my $gabage1 = <DATA>;
close DATA;
my @xml_files = ($gabage1);
my $debug = 0;
my $rmv_white_space = 1;
## -- XML start & end regexp substitution delimeter chars --
## match side , substitution side
## -----------------------/-------------------------
my @S_dlim = ('\[' , '['); # use these for reading (debug)
my @E_dlim = ('\]' , ']');
#my @S_dlim = (chr(140) , chr(140)); # use these for production
#my @E_dlim = (chr(141) , chr(141));
for (@xml_files)
{
if ($rmv_white_space) {
s/>[\s]+</></g;
s/[\s]+</</g;
s/>[\s]+/>/g;
}
print "\n",'='x30,"\n$_\n\n" if ($debug);
my $ROOT = {}; # container
my ($last_cnt, $cnt, $i) = (-1, 1, 0);
# should only need 2 iterations max, but wth
while ($cnt != $last_cnt && $i < 20)
{
$last_cnt = $cnt;
## <?XML-Version ?> , have to check the format of '<?'
while (s/<\?([^<>]*)\?>//i) {} # to void xml
versioning
# while (s/<\?([^<>]*)\?>/$S_dlim[1]$cnt$E_dlim[1]/i) {
print "$cnt <$1> = \n" if ($debug); $cnt++}
## <!-- Comments -->
# while (s/<!--([^<>]*)-->//i) {} # to void comments
while (s/<!--([^<>]*)-->/$S_dlim[1]$cnt$E_dlim[1]/i) {
print "$cnt <!-- --> = $1\n" if ($debug);
$ROOT->{$cnt} = { comment => $1 };
$cnt++;
}
# Comments, need to have "anything but <!-- nor -->
here" (revisit)
# while
(s/<!--([^(<!--)^(-->)]*)-->/$S_dlim[1]$cnt$E_dlim[1]/i) { print "$cnt
<!-- --> = $1\n" if ($debug); $cnt++}
## <Tag/> , no content
while
(s/<([0-9a-zA-Z]+)\/>/$S_dlim[1]$cnt$E_dlim[1]/i) {
print "$cnt <$1> = \n" if ($debug);
$ROOT->{$cnt} = { $1 => '' };
$cnt++;
}
## <Tag Attributes/> , no content
while (s/<([0-9a-zA-Z]+)([ ]+[0-9a-zA-Z]+[ ]*=[
]*"[^<]*")+[ ]*\/>/$S_dlim[1]$cnt$E_dlim[1]/i) {
print "$cnt <$1> = attr: $2\n" if ($debug);
$ROOT->{$cnt} = { $1 => getAttrHash($2) };
$cnt++;
}
## <Tag> Content </Tag>
while
(s/<([0-9a-zA-Z]+)>([^<]*)<\/\1>/$S_dlim[1]$cnt$E_dlim[1]/i) {
print "$cnt <$1> = $2\n" if ($debug);
my $unknown = '';
if (length($2) > 0) {
my ($key); my $hcontent =
getContentHash($2, $ROOT);
if (keys (%{$hcontent}) > 1) {
$unknown = $hcontent;
}
else { ($key,$unknown) = each
(%{$hcontent}); }
}
$ROOT->{$cnt} = { $1 => $unknown };
$cnt++;
}
## <Tag Attributes> Content </Tag>
while (s/<([0-9a-zA-Z]+)([ ]+[0-9a-zA-Z]+[ ]*=[
]*"[^<]*")+[ ]*>([^<]*)<\/\1>/$S_dlim[1]$cnt$E_dlim[1]/i) {
print "$cnt <$1> = attr: $2, content: $3\n" if
($debug);
my $hattrib = getAttrHash($2);
my $hcontent = getContentHash($3, $ROOT);
while (my ($key,$val) = each (%{$hcontent})) {
$hattrib->{$key} = $val;
}
$ROOT->{$cnt} = { $1 => $hattrib };
$cnt++;
}
$i++ if ($last_cnt != $cnt);
}
if (/<|>/) {
print "($i) XML problem, malformed, syntax or tag
closure:\n$_";
} else {
print "$i itterations\n\n";
#print Dumper($ROOT);
my $outer_element = $cnt-1;
if (exists $ROOT->{$outer_element}) {
my $tmp = {};
%{$tmp} = %{$ROOT->{$outer_element}};
print Dumper($tmp);
}
}
}
##
sub getAttrHash
{
my $attstr = shift;
my $ahref = {};
return $ahref unless (defined $attstr);
while ($attstr =~ s/[ ]*([0-9a-zA-Z]+)[ ]*=[ ]*"([^=]*)"[
]*//i) {
$ahref->{$1} = $2;
}
return $ahref;
}
##
sub getContentHash
{
my ($attstr,$hStore) = @_;
my $ahref = {};
return $ahref unless (defined $attstr && defined $hStore);
my @ary = ();
while ($attstr =~
s/([^<$S_dlim[0]$E_dlim[0]]+)|$S_dlim[0]([\d]+)$E_dlim[0]//i) {
if (defined $1) {
push (@ary, $1);
}
elsif (defined $2 && exists $hStore->{$2}) {
my ($key,$val) = each (%{$hStore->{$2}});
# here, force array is in effect (aka: simple)
# (this will be modified in a day or so)
################
if (exists $ahref->{$key})
{
#print "getChash - $key\n";
push (@{$ahref->{$key}}, $val);
} else {
$ahref->{$key} = [$val];
# $ahref->{$key} = $val;
}
################
}
}
if (scalar(@ary) == 1) {
$ahref->{'content'} = $ary[0];
} elsif (scalar(@ary) > 1) {
$ahref->{'content'} = [@ary];
}
return $ahref;
}
__END__
$VAR1 = {
'document' => {
'WMSNameSpaceVersion' => '2.0',
'comment' => [
' Control Protocol ',
' Data Protocol ',
' Feedback Protocol ',
' Network Source '
],
'node' => [
{
'opcode' => 'create',
'comment' => [
' Object Store
'
],
'name' => 'Control Protocol',
'node' => [
{
'opcode' =>
'create',
'comment' => [
'
RTSP ',
'
Sessionless Multicast '
],
'name' =>
'Object Store',
'node' => [
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'RTSP',
'node' => [
{
'opcode' => 'create',
'value' => '{308786f0-8b15-11d2-b25f-006097d2e41e}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'RTSP,RTSPA,RTSPT,RTSPU,RTSPM',
'name' => 'Protocol',
'type' => 'string'
}
]
}
]
},
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'Sessionless Multicast',
'node' => [
{
'opcode' => 'create',
'value' => '{f9377800-f38d-11d2-b26c-006097d2e41e}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'MCAST,RTP',
'name' => 'Protocol',
'type' => 'string'
}
]
}
]
}
]
},
{
'opcode' =>
'create',
'name' =>
'Shared Properties'
}
]
},
{
'opcode' => 'create',
'comment' => [
' Object Store
'
],
'name' => 'Data Protocol',
'node' => [
{
'opcode' =>
'create',
'comment' => [
'
RTP ',
'
RTP/ASF ',
'
RTP/AVP ',
'
RTP/FEC ',
'
RTP/WMS-FEC '
],
'name' =>
'Object Store',
'node' => [
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'RTP',
'node' => [
{
'opcode' => 'create',
'value' => '{cbfb2e20-ab7b-11d2-b261-006097d2e41e}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'x-asf-pf',
'name' => 'Format',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => 'RTP/AVP',
'name' => 'Protocol',
'type' => 'string'
}
]
}
]
},
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'RTP/ASF',
'node' => [
{
'opcode' => 'create',
'value' => '{149a44be-dc14-4e94-9cb0-c0268e77df9e}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'x-asfv2-pf,x-asfv2-grp-pf,x-asfv2-frag-pf',
'name' => 'Format',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => 'RTP/AVP',
'name' => 'Protocol',
'type' => 'string'
}
]
}
]
},
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'RTP/AVP',
'node' => [
{
'opcode' => 'create',
'value' => '{d7335e2e-62eb-4ad0-96cd-b31c9d0f9f85}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'PCMU,L8,L16,MPA,G726-24,G726-40',
'name' => 'Format',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => 'RTP/AVP',
'name' => 'Protocol',
'type' => 'string'
}
]
}
]
},
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'RTP/FEC',
'node' => [
{
'opcode' => 'create',
'value' => '{02DEFE42-F8FC-11d2-8670-00C04F6890ED}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'parityfec',
'name' => 'Format',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => 'RTP/AVP',
'name' => 'Protocol',
'type' => 'string'
}
]
}
]
},
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'RTP/WMS-FEC',
'node' => [
{
'opcode' => 'create',
'value' => '{EDAB8E6B-746C-40db-A885-9E4A9EEF27A2}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'wms-fec',
'name' => 'Format',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => 'RTP/AVP',
'name' => 'Protocol',
'type' => 'string'
}
]
}
]
}
]
},
{
'opcode' =>
'create',
'name' =>
'Shared Properties'
}
]
},
{
'opcode' => 'create',
'comment' => [
' Object Store
'
],
'name' => 'Feedback Protocol',
'node' => [
{
'opcode' =>
'create',
'comment' => [
'
RTCP '
],
'name' =>
'Object Store',
'node' => [
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'RTCP',
'node' => [
{
'opcode' => 'create',
'value' => '{ecfddc81-184e-11d3-ae84-00a0c95ec3f0}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'x-wms-rtx',
'name' => 'Format',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => 'RTP/AVP',
'name' => 'Protocol',
'type' => 'string'
}
]
}
]
}
]
},
{
'opcode' =>
'create',
'name' =>
'Shared Properties'
}
]
},
{
'opcode' => 'create',
'comment' => [
' Object Store
',
' Shared
Properties '
],
'name' => 'Network Source',
'node' => [
{
'opcode' =>
'create',
'comment' => [
'
WMS Http Network Source ',
'
WMS Mms Network Source ',
'
WMS Msbd Network Source ',
'
WMS Network Source '
],
'name' =>
'Object Store',
'node' => [
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'WMS Http Network Source',
'node' => [
{
'opcode' => 'create',
'value' => '{566A2EFF-5651-4020-AC1A-EB48E4571EA3}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'HTTP',
'name' => 'Source Type',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x50',
'name' => 'DefaultHttpServerPort',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x1bb',
'name' => 'DefaultHttpServerSSLPort',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x8',
'name' => 'PacketBuffers',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'EnableHTTP1_1',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x1e',
'name' => 'OpenTimeout',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x64',
'name' => 'SecondSegmentTimeout',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '',
'name' => 'ControlAdapter',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x55',
'name' => 'PercentBWUsageForAccelStreaming',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x3',
'name' => 'Proxy Setting',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '',
'name' => 'ProxyHostName',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x50',
'name' => 'ProxyPort',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'ProxyBypassForLocal',
'type' => 'int32'
}
]
}
]
},
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'WMS Mms Network Source',
'node' => [
{
'opcode' => 'create',
'value' => '{DCF6C8B2-F6C0-461b-82DA-35945EADF54A}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'MMS,MMST,MMSU',
'name' => 'Source Type',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x6db',
'name' => 'DefaultServerPort',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x4',
'name' => 'MaxReadHeaderRetries',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x8',
'name' => 'PacketBuffers',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'DropProb',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'DropGracePeriod',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'FirstDropGracePeriod',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'DropBurstDuration',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'PacketPairDropProb',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x2',
'name' => 'NackAlgorithm',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'NackRateMultiplier',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x5dc',
'name' => 'NackBurst',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x3e8',
'name' => 'NackTraceInterval',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'NackRetry',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'IgnoreServerVersion',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'EnableMmsDistribution',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'AssertStrangeErrors',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x5a',
'name' => 'InactivityTimeout',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x20',
'name' => 'OpenTimeout',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x55',
'name' => 'PercentBWUsageForAccelStreaming',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '',
'name' => 'FunnelAdapter',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '',
'name' => 'ControlAdapter',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'Proxy Setting',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '',
'name' => 'ProxyHostName',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x6db',
'name' => 'ProxyPort',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'ProxyBypassForLocal',
'type' => 'int32'
}
]
}
]
},
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'WMS Msbd Network Source',
'node' => [
{
'opcode' => 'create',
'value' => '{FB74F625-7D25-4455-B840-7B870B5B9322}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'ASFM',
'name' => 'Source Type',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x8',
'name' => 'PacketBuffers',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'DropProb',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'DropGracePeriod',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'FirstDropGracePeriod',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'DropBurstDuration',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x3a98',
'name' => 'McastTimeout',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'EnableIGMPv3',
'type' => 'int32'
}
]
}
]
},
{
'opcode' => 'create',
'comment' => [
' Properties '
],
'name' => 'WMS Network Source',
'node' => [
{
'opcode' => 'create',
'value' => '{ad763fa6-3b90-41ab-bd44-4f832beee55f}',
'name' => 'CLSID',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'Enabled',
'type' => 'int32'
},
{
'opcode' => 'create',
'name' => 'Properties',
'node' => [
{
'opcode' => 'create',
'value' => 'RTSP,XSDP,RTP,RTSPA,RTSPT,RTSPU,RTSPM',
'name' => 'Source Type',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'EnableATM',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'MaximumMTU',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x14',
'name' => 'FirewallTimeout',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x1e',
'name' => 'OpenTimeout',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'RtxDropProb',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'DropProb',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'DropGracePeriod',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'FirstDropGracePeriod',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'DropBurstDuration',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'PacketPairDropProb',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x2',
'name' => 'NackAlgorithm',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'NackRateMultiplier',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x5dc',
'name' => 'NackBurst',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x3e8',
'name' => 'NackTraceInterval',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x1',
'name' => 'NackRetry',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'BurstProtection',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'EmulateNetworkDisconnect',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'AssertStrangeErrors',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x55',
'name' => 'PercentBWUsageForAccelStreaming',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'Proxy Setting',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '',
'name' => 'ProxyHostName',
'type' => 'string'
},
{
'opcode' => 'create',
'value' => '0x22a',
'name' => 'ProxyPort',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x0',
'name' => 'ProxyBypassForLocal',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x3e8',
'name' => 'PktGracePeriodAtEOSForBPP',
'type' => 'int32'
},
{
'opcode' => 'create',
'value' => '0x9c4',
'name' => 'PktGracePeriodAtEOSForODP',
'type' => 'int32'
}
]
}
]
}
]
},
{
'opcode' =>
'create',
'name' =>
'Shared Properties',
'node' => [
{
'opcode' => 'create',
'name' => 'Local'
}
]
}
]
}
]
}
};
__DATA__
<document WMSNameSpaceVersion="2.0">
<node name="Control Protocol" opcode="create" >
<node name="Object Store" opcode="create" >
<node name="RTSP" opcode="create" >
<node name="CLSID" opcode="create" type="string"
value="{308786f0-8b15-11d2-b25f-006097d2e41e}" />
<node name="Enabled" opcode="create" type="int32" value="0x1"
/>
<node name="Properties" opcode="create" >
<node name="Protocol" opcode="create" type="string"
value="RTSP,RTSPA,RTSPT,RTSPU,RTSPM" />
</node> <!-- Properties -->
</node> <!-- RTSP -->
<node name="Sessionless Multicast" opcode="create" >
<node name="CLSID" opcode="create" type="string"
value="{f9377800-f38d-11d2-b26c-006097d2e41e}" />
<node name="Enabled" opcode="create" type="int32" value="0x1"
/>
<node name="Properties" opcode="create" >
<node name="Protocol" opcode="create" type="string"
value="MCAST,RTP" />
</node> <!-- Properties -->
</node> <!-- Sessionless Multicast -->
</node> <!-- Object Store -->
<node name="Shared Properties" opcode="create" />
</node> <!-- Control Protocol -->
<node name="Data Protocol" opcode="create" >
<node name="Object Store" opcode="create" >
<node name="RTP" opcode="create" >
<node name="CLSID" opcode="create" type="string"
value="{cbfb2e20-ab7b-11d2-b261-006097d2e41e}" />
<node name="Enabled" opcode="create" type="int32" value="0x1"
/>
<node name="Properties" opcode="create" >
<node name="Format" opcode="create" type="string"
value="x-asf-pf" />
<node name="Protocol" opcode="create" type="string"
value="RTP/AVP" />
</node> <!-- Properties -->
</node> <!-- RTP -->
<node name="RTP/ASF" opcode="create" >
<node name="CLSID" opcode="create" type="string"
value="{149a44be-dc14-4e94-9cb0-c0268e77df9e}" />
<node name="Enabled" opcode="create" type="int32" value="0x1"
/>
<node name="Properties" opcode="create" >
<node name="Format" opcode="create" type="string"
value="x-asfv2-pf,x-asfv2-grp-pf,x-asfv2-frag-pf" />
<node name="Protocol" opcode="create" type="string"
value="RTP/AVP" />
</node> <!-- Properties -->
</node> <!-- RTP/ASF -->
<node name="RTP/AVP" opcode="create" >
<node name="CLSID" opcode="create" type="string"
value="{d7335e2e-62eb-4ad0-96cd-b31c9d0f9f85}" />
<node name="Enabled" opcode="create" type="int32" value="0x1"
/>
<node name="Properties" opcode="create" >
<node name="Format" opcode="create" type="string"
value="PCMU,L8,L16,MPA,G726-24,G726-40" />
<node name="Protocol" opcode="create" type="string"
value="RTP/AVP" />
</node> <!-- Properties -->
</node> <!-- RTP/AVP -->
<node name="RTP/FEC" opcode="create" >
<node name="CLSID" opcode="create" type="string"
value="{02DEFE42-F8FC-11d2-8670-00C04F6890ED}" />
<node name="Enabled" opcode="create" type="int32" value="0x1"
/>
<node name="Properties" opcode="create" >
<node name="Format" opcode="create" type="string"
value="parityfec" />
<node name="Protocol" opcode="create" type="string"
value="RTP/AVP" />
</node> <!-- Properties -->
</node> <!-- RTP/FEC -->
<node name="RTP/WMS-FEC" opcode="create" >
<node name="CLSID" opcode="create" type="string"
value="{EDAB8E6B-746C-40db-A885-9E4A9EEF27A2}" />
<node name="Enabled" opcode="create" type="int32" value="0x1"
/>
<node name="Properties" opcode="create" >
<node name="Format" opcode="create" type="string"
value="wms-fec" />
<node name="Protocol" opcode="create" type="string"
value="RTP/AVP" />
</node> <!-- Properties -->
</node> <!-- RTP/WMS-FEC -->
</node> <!-- Object Store -->
<node name="Shared Properties" opcode="create" />
</node> <!-- Data Protocol -->
<node name="Feedback Protocol" opcode="create" >
<node name="Object Store" opcode="create" >
<node name="RTCP" opcode="create" >
<node name="CLSID" opcode="create" type="string"
value="{ecfddc81-184e-11d3-ae84-00a0c95ec3f0}" />
<node name="Enabled" opcode="create" type="int32" value="0x1"
/>
<node name="Properties" opcode="create" >
<node name="Format" opcode="create" type="string"
value="x-wms-rtx" />
<node name="Protocol" opcode="create" type="string"
value="RTP/AVP" />
</node> <!-- Properties -->
</node> <!-- RTCP -->
</node> <!-- Object Store -->
<node name="Shared Properties" opcode="create" />
</node> <!-- Feedback Protocol -->
<node name="Network Source" opcode="create" >
<node name="Object Store" opcode="create" >
<node name="WMS Http Network Source" opcode="create" >
<node name="CLSID" opcode="create" type="string"
value="{566A2EFF-5651-4020-AC1A-EB48E4571EA3}" />
<node name="Enabled" opcode="create" type="int32" value="0x1"
/>
<node name="Properties" opcode="create" >
<node name="Source Type" opcode="create" type="string"
value="HTTP" />
<node name="DefaultHttpServerPort" opcode="create"
type="int32" value="0x50" />
<node name="DefaultHttpServerSSLPort" opcode="create"
type="int32" value="0x1bb" />
<node name="PacketBuffers" opcode="create" type="int32"
value="0x8" />
<node name="EnableHTTP1_1" opcode="create" type="int32"
value="0x1" />
<node name="OpenTimeout" opcode="create" type="int32"
value="0x1e" />
<node name="SecondSegmentTimeout" opcode="create"
type="int32" value="0x64" />
<node name="ControlAdapter" opcode="create" type="string"
value="" />
<node name="PercentBWUsageForAccelStreaming" opcode="create"
type="int32" value="0x55" />
<node name="Proxy Setting" opcode="create" type="int32"
value="0x3" />
<node name="ProxyHostName" opcode="create" type="string"
value="" />
<node name="ProxyPort" opcode="create" type="int32"
value="0x50" />
<node name="ProxyBypassForLocal" opcode="create"
type="int32" value="0x0" />
</node> <!-- Properties -->
</node> <!-- WMS Http Network Source -->
<node name="WMS Mms Network Source" opcode="create" >
<node name="CLSID" opcode="create" type="string"
value="{DCF6C8B2-F6C0-461b-82DA-35945EADF54A}" />
<node name="Enabled" opcode="create" type="int32" value="0x1"
/>
<node name="Properties" opcode="create" >
<node name="Source Type" opcode="create" type="string"
value="MMS,MMST,MMSU" />
<node name="DefaultServerPort" opcode="create" type="int32"
value="0x6db" />
<node name="MaxReadHeaderRetries" opcode="create"
type="int32" value="0x4" />
<node name="PacketBuffers" opcode="create" type="int32"
value="0x8" />
<node name="DropProb" opcode="create" type="int32"
value="0x0" />
<node name="DropGracePeriod" opcode="create" type="int32"
value="0x0" />
<node name="FirstDropGracePeriod" opcode="create"
type="int32" value="0x0" />
<node name="DropBurstDuration" opcode="create" type="int32"
value="0x0" />
<node name="PacketPairDropProb" opcode="create" type="int32"
value="0x0" />
<node name="NackAlgorithm" opcode="create" type="int32"
value="0x2" />
<node name="NackRateMultiplier" opcode="create" type="int32"
value="0x1" />
<node name="NackBurst" opcode="create" type="int32"
value="0x5dc" />
<node name="NackTraceInterval" opcode="create" type="int32"
value="0x3e8" />
<node name="NackRetry" opcode="create" type="int32"
value="0x1" />
<node name="IgnoreServerVersion" opcode="create"
type="int32" value="0x0" />
<node name="EnableMmsDistribution" opcode="create"
type="int32" value="0x0" />
<node name="AssertStrangeErrors" opcode="create"
type="int32" value="0x0" />
<node name="InactivityTimeout" opcode="create" type="int32"
value="0x5a" />
<node name="OpenTimeout" opcode="create" type="int32"
value="0x20" />
<node name="PercentBWUsageForAccelStreaming" opcode="create"
type="int32" value="0x55" />
<node name="FunnelAdapter" opcode="create" type="string"
value="" />
<node name="ControlAdapter" opcode="create" type="string"
value="" />
<node name="Proxy Setting" opcode="create" type="int32"
value="0x0" />
<node name="ProxyHostName" opcode="create" type="string"
value="" />
<node name="ProxyPort" opcode="create" type="int32"
value="0x6db" />
<node name="ProxyBypassForLocal" opcode="create"
type="int32" value="0x0" />
</node> <!-- Properties -->