Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: XML module which one

by tmharish (Friar)
on Feb 05, 2013 at 04:10 UTC ( #1017054=note: print w/ replies, xml ) Need Help??


in reply to XML module which one

XML::Smart:

use strict ; use warnings ; use XML::Smart ; my %hash = ( 'key1' => 'value1' , 'key2' => 'value2' , 'key3' => 'value3' , 'key4' => 'value4' , ); my $xml_obj = new XML::Smart(); foreach my $key ( keys %hash ) { $xml_obj->{form}{$key} = { CONTENT => $hash{ $key } } ; } print $xml_obj->data();

Output

<?xml version="1.0" encoding="iso-8859-1" ?> <?meta name="GENERATOR" content="XML::Smart/1.74 Perl/5.010001 [linux] +" ?> <form> <key2>value2</key2> <key4>value4</key4> <key1>value1</key1> <key3>value3</key3> </form>


Comment on Re: XML module which one
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (11)
As of 2014-08-22 12:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (156 votes), past polls