/[webpac2]/trunk/t/conf/mungle/xml.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/t/conf/mungle/xml.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1032 - (show annotations)
Sun Nov 11 20:00:29 2007 UTC (16 years, 5 months ago) by dpavlin
File MIME type: text/plain
File size: 691 byte(s)
 r1602@llin:  dpavlin | 2007-11-11 21:00:33 +0100
 added forgoten test data

1 # special mungle file which prepare data_structure from XML
2
3 my $ds = get_ds;
4 warn "## ds = ",dump( $ds );
5
6 my @a = ( 'foo' );
7 my @s = ( 'bar' );
8
9 # check if tag is scalar or array and add it
10 foreach my $tag ( qw/number array/ ) {
11 if ( ref($xml->{$tag}) eq 'ARRAY' ) {
12 push @a, $tag;
13 } else {
14 push @s, $tag;
15 }
16 }
17
18 warn '## collect data from @a = ',dump( @a ), ' @s = ',dump( @s );
19
20 # unroll content from arrays
21 foreach my $tag ( @a ) {
22 next unless defined $ds->{xml}->{$tag};
23 set_ds( $tag => [
24 map { $_->{content} } @{ $ds->{xml}->{$tag} }
25 ] );
26 }
27
28 # and just copy scalars
29 foreach my $tag ( @s ) {
30 next unless defined $ds->{xml}->{$tag};
31 set_ds( $tag => $ds->{xml}->{$tag} );
32 }
33

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26