]> git.evergreen-ils.org Git - working/SIPServer.git/blob - xmlparse.pl
LP1528301: (follow-up) tweak whitespace
[working/SIPServer.git] / xmlparse.pl
1 #!/usr/bin/perl
2 #
3 # Copyright (C) 2006-2008  Georgia Public Library Service
4
5 # Author: David J. Fiander
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 #
20 # This file reads a SIPServer xml-format configuration file and dumps it
21 # to stdout.  Just to see what the structures look like.
22 #
23 # The 'new XML::Simple' option must agree exactly with the configuration
24 # in Sip::Configuration.pm
25 #
26 use strict;
27 use English;
28
29 use XML::Simple qw(:strict);
30 use Data::Dumper;
31
32 my $parser = new XML::Simple( KeyAttr   => { login => '+id',
33                                              institution => '+id',
34                                              service => '+port', },
35                               GroupTags =>  { listeners => 'service',
36                                               accounts => 'login',
37                                               institutions => 'institution', },
38                               ForceArray=> [ 'service',
39                                              'login',
40                                              'institution' ],
41                               ValueAttr =>  { 'error-detect' => 'enabled',
42                                              'min_servers' => 'value',
43                                              'max_servers' => 'value'} );
44
45 my $ref = $parser->XMLin($ARGV[0]);
46
47 $Data::Dumper::Indent = 1;
48 print Dumper($ref);