Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: XML module which one

by tmharish (Friar)
on Feb 05, 2013 at 04:10 UTC ( [id://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>

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-19 17:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found