in reply to Generating elements with attributes and contents using XML::Smart
This will create what you want:
Output:use XML::Smart ; my $xml = new XML::Smart() ; $xml->{phone} = '555-1234' ; $xml->{phone}{type} = 'home' ; print $xml->data ;
See the method apply_dtd() in the XML::Smart documentation to apply automatically a DTD to all your tree.<?xml version="1.0" encoding="iso-8859-1" ?> <?meta name="GENERATOR" content="XML::Smart/1.6.8 Perl/5.006001 [MSWin +32]" ?> <phone type="home">555-1234</phone>
Graciliano M. P.
"Creativity is the expression of the liberty".
In Section
Seekers of Perl Wisdom