1 |
#!/usr/bin/perl -w |
2 |
|
3 |
use strict; |
4 |
use XML::Simple; |
5 |
use IO::File; |
6 |
use Data::Dumper; |
7 |
|
8 |
my $xml = '<?xml version="1.0" encoding="ISO-8859-2"?> |
9 |
<xml> |
10 |
<isis delimiter=" aa ">foo</isis> |
11 |
<isis> |
12 |
<delimiter> aa </delimiter> |
13 |
<format>foo</format> |
14 |
</isis> |
15 |
|
16 |
<test foo="a" foo_a=" a" foo_a_=" a " fooa_="a ">truæ</test> |
17 |
</xml>'; |
18 |
|
19 |
my $xml_file = shift @ARGV; |
20 |
|
21 |
if ($xml_file) { |
22 |
my $fh = new IO::File($xml_file) || die "can't open $xml_file: $!"; |
23 |
$xml = XMLin($fh); |
24 |
} else { |
25 |
$xml = XMLin($xml, |
26 |
ForceArray => [ 'isis', 'config', 'format' ], |
27 |
ForceContent => 1, |
28 |
NormaliseSpace => 0, |
29 |
KeyAttr => [ 'isis' ] |
30 |
); |
31 |
} |
32 |
|
33 |
print Dumper($xml),"\n"; |
34 |
|