Brer Monk,
I wrote a quick little ditty to check out your XML as follows:

#!/usr/bin/perl -w use strict; use XML::Simple; use Data::Dumper; my $stuff=XMLin(); print Dumper($stuff);
When I ran my code I noticed the following oddity in the Data::Dumper output:
$VAR1 = { 'server' => { 'location' => 'atlanta', 'name' => 'cns04-fs16', 'event' => { 'name' => 'diskname > online 6.43 days 10.10.10.10 yellow Thu Mar 30 15:03:16 EST 2006 Disk on cns04-fs16 at WARNING level yellow /mail/vol/cns04-fs16 (93%) has reached the defined disk sp +ace WARNING level (92%) titan atlanta Storage Servers Bluearc Servers basys online 6.44 days 10.10.10.10 yellow Thu Mar 30 15:05:12 2006 yellow node 1 is in status (notUp) yellow TITANPC-2 is in status (notUp) yellow EVS006 is in status (offLine) ' }, 'grouping' => { 'secondary' => 'Mail Filers', 'primary' => 'Storage Servers' } } };

Immediately I suspected that your XML had some sort of error in it and lo and behold, if I changed one line from

<name>disk</ name >
to
<name>disk</name>
eliminating the extra space after the closing tag's slash and when I reran my test I got:
$VAR1 = { 'server' => { 'titan ' => { 'location' => 'atlanta', 'grouping' => { 'secondary' => 'Bluear +c Servers', 'primary' => 'Storage +Servers' }, 'event' => { 'sparedata' => {}, 'entry' => [ { 'color' => ' +yellow', 'desc' => 'n +ode 1 is in status (notUp)' }, { 'color' => ' +yellow', 'desc' => 'T +ITANPC-2 is in status (notUp)' }, { 'color' => ' +yellow', 'desc' => 'E +VS006 is in status (offLine)' } ], 'received_by' => '10.10.1 +0.10', 'name' => 'basys', 'state' => { 'name' => 'onl +ine', 'data' => {} }, 'received_at' => 'Thu Mar + 30 15:05:12 2006', 'length' => '6.44 days', 'color' => 'yellow' } }, 'cns04-fs16' => { 'location' => 'atlanta', 'grouping' => { 'secondary' => 'Ma +il Filers', 'primary' => 'Stor +age Servers' }, 'event' => { 'sparedata' => 'Disk +on cns04-fs16 at WARNING level', 'entry' => { 'color' => + 'yellow', + 'desc' => '/mail/vol/cns04-fs16 (93%) has reached the defined disk s +pace WARNING level (92%)' }, 'received_by' => '10. +10.10.10', 'name' => +'disk', 'state' => { 'name' => +'online', 'data' => +{} }, 'received_at' => 'Thu + Mar 30 15:03:16 EST 2006', 'length' => '6.43 day +s', 'color' => 'yellow' } } } };

That to my eye looks much better.

Now, I must confess that my XML foo is not quite what it should be so I'm not sure if the space after the closing tag's slash is allowed there or not, but I'm not arguing with results. Either the XML was incorrect or there is a parsing issue with XML::Simple.

HTH


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

In reply to Re: XML::Simple element handling by blue_cowdawg
in thread XML::Simple element handling by linwood

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.