dsheroh has asked for the wisdom of the Perl Monks concerning the following question:
produces#!/usr/bin/perl use strict; use warnings; use XML::Simple qw(xml_in xml_out); my $req = { Foo => { Bar => 1, Baz => [ 2 ], }, }; print xml_out($req);
which is just about what I expected... except where did the outer <opt>...</opt> come from and how do I get rid of it?<opt> <Foo Bar="1"> <Baz>2</Baz> </Foo> </opt>
(Granted, it's possible that the <opt> doesn't matter and everything would work fine even with it there, but it's not present in any of Element Express's samples of writing the XML by hand with a series of print statements, so I'd prefer that it not be there. And also granted I could strip off the first and last lines to get rid of it, but that's ugly and just feels wrong. So I'd really prefer to find a way to get XML::Simple to let me specify the outermost container myself instead of wrapping everything in an <opt> for no apparent reason.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: <opt>-less XML::Simple
by Anonymous Monk on Dec 18, 2007 at 03:52 UTC | |
by dsheroh (Monsignor) on Dec 18, 2007 at 04:00 UTC |