Hi Monks,
I have a piece of code that creates an XML as below:
push (@arr, {'Phones' => [
{'Manufacturer' => $unique_manufacturer_model_version[
+$i][9],
'Model' => $unique_manufacturer_model_version[$i][10],
'Version' => $unique_manufacturer_model_version[$i][11],
'Count' => $unique_manufacturer_model_version[$i][12] }
+] } );
}
my $xml = new XML::Simple(NoAttr=>1,RootName=>'terminalversioncount');
I notice that the output is
<?xml version='1.0'?>
<terminalversioncount>
<anon>
<Phones>
<Count>2</Count>
<Manufacturer>Sony</Manufacturer>
<Model>SE1</Model>
<Version>M94</Version>
</Phones>
</anon>
How can I get rid of the <anon>? I want them to be nested under <Phones> only, for each entry.
Another question is, is it possible to append another set of different information (table) to the same XML output file? It seems that RootName can only be set once. Or does it means that I cannot use RootName as a delimiter for different tables?
Thanks.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|