Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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 cooling their heels in the Monastery: (6)
As of 2015-07-03 17:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (54 votes), past polls