Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Creating nested elements in XML::Smart

by bitingduck (Friar)
on Dec 12, 2012 at 08:02 UTC ( #1008466=note: print w/ replies, xml ) Need Help??


in reply to Creating nested elements in XML::Smart

This seems to work:

use strict; use warnings; use XML::Smart; my @pp=qw(Puebla01 Puebla02); my @shelf=qw(7480 7440); my @comment=("ATM Core switch","ATM access switch"); my $XML = XML::Smart->new() ; my $count=0; foreach (@pp){ $XML->{Shelf_Info}{switch}[$count]{Name} = "$_"; $XML->{Shelf_Info}{switch}[$count]{shelfType} = $shelf[$count]; $XML->{Shelf_Info}{switch}[$count]{shelfType}->set_node(1); $XML->{Shelf_Info}{switch}[$count]{commentText} = "$comment[$count +]"; $XML->{Shelf_Info}{switch}[$count]{commentText}->set_node(2); $count++; } $XML->save('test.xml') ;

It seems to want array refs to iterate over nodes.


Comment on Re: Creating nested elements in XML::Smart
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1008466]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2014-12-28 01:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls