http://qs321.pair.com?node_id=384276


in reply to Generating elements with attributes and contents using XML::Smart

This will create what you want:
use XML::Smart ; my $xml = new XML::Smart() ; $xml->{phone} = '555-1234' ; $xml->{phone}{type} = 'home' ; print $xml->data ;
Output:
<?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>
See the method apply_dtd() in the XML::Smart documentation to apply automatically a DTD to all your tree.

Graciliano M. P.
"Creativity is the expression of the liberty".