Ok

So here is what I have:

#!/usr/bin/perl use strict; use warnings; use LWP::Simple; use XML::Simple; # use XML::LibXML; use POSIX qw(strftime); no warnings 'uninitialized'; use Data::Dumper; my $data_dir = "/weatherdata"; my $current_file = 'SDC095.xml'; my $current = XMLin($current_file); # These seem to work if there is no active alert # my $warntitle = $current->{'entry'}->{'title'}; # my $warnlink = $current->{'entry'}->{'id'}; # my $warntext = $current->{'entry'}->{'summary'}; # These work if I already know the full URL for the alert my $warntitle = $current->{'entry'}->{'http://alerts.weather.gov/cap/w +wacapget.php?x=SD124CB88C681C.SpecialWeatherStatement.124CB88C9184SD. +UNRSPSUNR.046ee1fda521a403079118865edf9ad4'}->{'title'}; my $warnlink = $current->{'entry'}->{'http://alerts.weather.gov/cap/ww +acapget.php?x=SD124CB88C681C.SpecialWeatherStatement.124CB88C9184SD.U +NRSPSUNR.046ee1fda521a403079118865edf9ad4'}->{'id'}; my $warntext = $current->{'entry'}->{'http://alerts.weather.gov/cap/ww +acapget.php?x=SD124CB88C681C.SpecialWeatherStatement.124CB88C9184SD.U +NRSPSUNR.046ee1fda521a403079118865edf9ad4'}->{'summary'}; print "$warntitle\n"; print "$warnlink\n"; print "$warntext\n"; # print output # print Dumper($current);

And here is the XML file:

https://dl.dropbox.com/u/2859483/SDC095.xml

It wont let me post it as code in this message

So, usually if there is no warnings in the area, I get the data ok, but in this case, instead of the second tier being 'title' 'id' and 'summary' those are being pushed to the third tier, and the second tier key is now 'http://alerts.weather.gov/cap/wwacapget.php?x=SD124CB88C681C.SpecialWeatherStatement.124CB88C9184SD.UNRSPSUNR.046ee1fda521a403079118865edf9ad4' and since I do not know that in advance, it's hard to get results that way.

John


In reply to Re: Parsing NWS Public Alerts in CAP/ATOM by johnfl68
in thread Parsing NWS Public Alerts in CAP/ATOM by johnfl68

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.