Thread XML::Simple - Datenstruktur gesucht (1 answers)
Opened by pktm at 2009-08-04 08:21

pktm
 2009-08-04 09:06
#123846 #123846
User since
2003-08-07
2921 Artikel
BenutzerIn
[Homepage]
user image
So, nach etwas experimentieren hier eine Lösung:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/perl -w

use strict;
use warnings;
use Data::Dumper qw/Dumper/;
use Perl6::Say;
use FindBin qw/$Bin/;
use XML::Simple;

my @data = (
{
url => [
{
loc => 'loc',
changefreq => 'changefreq',
priority => 'priority',
},
{
loc => 'loc2',
changefreq => 'changefreq2',
priority => 'priority2',
},
],
},
);


my $xs = XML::Simple->new(
ForceArray => 1,
XMLDecl => 1,
NoAttr => 1,
KeepRoot => 1,
);
my $xml = $xs->XMLout(
{urlset => \@data},
#OutputFile => $outfile,
);

print Dumper $xml;
http://www.intergastro-service.de (mein erstes CMS :) )

View full thread XML::Simple - Datenstruktur gesucht