Leser: 1
5 Einträge, 1 Seite |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/usr/bin/perl use strict; use warnings; use XML::Simple; use Data::Dumper; my $hashref = { parent => { one => { name => "aname", other => "something"}, two => { name => "anothername", stuff => "bladder"} } }; print Dumper($hashref). "\n"; print XMLout($hashref). "\n";
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$VAR1 = {
'parent' => {
'one' => {
'other' => 'something',
'name' => 'aname'
},
'two' => {
'name' => 'anothername',
'stuff' => 'bladder'
}
}
};
<opt>
<parent name="aname" other="something" />
<parent name="anothername" stuff="bladder" />
</opt>
use XML::Simple qw(:strict);
print XMLout($hashref, KeyAttr => []);
1
2
3
4
5
6
<opt>
<parent>
<one name="aname" other="something" />
<two name="anothername" stuff="bladder" />
</parent>
</opt>
perldoc XML::SimpleNote 1: The default value for 'KeyAttr' is ['name', 'key', 'id']. If you do not want folding on input or unfolding on output you must setting this option to an empty list to disable the feature.
5 Einträge, 1 Seite |