or XML::Simple, ex
#!/usr/bin/perl -- use strict; use warnings; use Data::Dumper; use XML::Simple; my $xml = q~<?xml version="1.0"?> <rss version="2.0"> <channel> <title>Example 2.0 Channel with Enclosure sub-element of Item</title +> <link>http://example.com/</link> <description>To lead by example</description> <language>en-us</language> <copyright>All content Public Domain, except comments which remains +copyright the author</copyright> <managingEditor>editor@example.com</managingEditor> <webMaster>webmaster@example.com</webMaster> <docs>http://backend.userland.com/rss</docs> <category domain="http://www.dmoz.org">Reference/Libraries/Library_ +and_Information_Science/Technical_Services/Cataloguing/Metadata/RDF/A +pplications/RSS/</category> <generator>The Superest Dooperest RSS Generator</generator> <lastBuildDate>Mon, 02 Sep 2002 03:19:17 GMT</lastBuildDate> <ttl>60</ttl> <item> <title>News for September the Second</title> <link>http://example.com/2002/09/02</link> <description>other things happened today</description> <comments>http://example.com/2002/09/02/comments.html</comments> <author>joeuser@example.com</author> <pubDate>Mon, 02 Sep 2002 03:19:00 GMT</pubDate> <guid isPermaLink="true">http://example.com/2002/09/02</guid> <enclosure url="http://www.scripting.com/mp3s/weatherReportSuite.mp +3" length="12216320" type="audio/mpeg" /> </item> <item> <title>22News for September the Second</title> <link>http://22example.com/2002/09/02</link> <description>22other things happened today</description> <comments>http://22example.com/2002/09/02/comments.html</comments> <author>22joeuser@22example.com</author> <pubDate>Mon, 22 Sep 2002 03:19:00 GMT</pubDate> <guid isPermaLink="true">http://22example.com/2002/09/02</guid> <enclosure url="http://www.22scripting.com/mp3s/22weatherReportSuit +e.mp3" length="12216320" type="audio/mpeg" /> </item> </channel> </rss>~; $xml = XMLin( $xml, ForceArray => ['item'], ); local $Data::Dumper::Indent=1; print Dumper( $xml ),"\n"; my $items = $xml->{channel}{item}; for my $i( @$items ){ print $i->{enclosure}{url},"\n"; } __END__ $VAR1 = { 'version' => '2.0', 'channel' => { 'link' => 'http://example.com/', 'language' => 'en-us', 'ttl' => '60', 'item' => [ { 'enclosure' => { 'length' => '12216320', 'url' => 'http://www.scripting.com/mp3s/weatherReportSuite.m +p3', 'type' => 'audio/mpeg' }, 'link' => 'http://example.com/2002/09/02', 'author' => 'joeuser@example.com', 'comments' => 'http://example.com/2002/09/02/comments.html', 'description' => 'other things happened today', 'title' => 'News for September the Second', 'guid' => { 'isPermaLink' => 'true', 'content' => 'http://example.com/2002/09/02' }, 'pubDate' => 'Mon, 02 Sep 2002 03:19:00 GMT' }, { 'enclosure' => { 'length' => '12216320', 'url' => 'http://www.22scripting.com/mp3s/22weatherReportSui +te.mp3', 'type' => 'audio/mpeg' }, 'link' => 'http://22example.com/2002/09/02', 'author' => '22joeuser@22example.com', 'comments' => 'http://22example.com/2002/09/02/comments.html', 'description' => '22other things happened today', 'title' => '22News for September the Second', 'guid' => { 'isPermaLink' => 'true', 'content' => 'http://22example.com/2002/09/02' }, 'pubDate' => 'Mon, 22 Sep 2002 03:19:00 GMT' } ], 'copyright' => 'All content Public Domain, except comments which r +emains copyright the author', 'description' => 'To lead by example', 'generator' => 'The Superest Dooperest RSS Generator', 'lastBuildDate' => 'Mon, 02 Sep 2002 03:19:17 GMT', 'category' => { 'domain' => 'http://www.dmoz.org', 'content' => 'Reference/Libraries/Library_and_Information_Scienc +e/Technical_Services/Cataloguing/Metadata/RDF/Applications/RSS/' }, 'title' => 'Example 2.0 Channel with Enclosure sub-element of Item +', 'webMaster' => 'webmaster@example.com', 'docs' => 'http://backend.userland.com/rss', 'managingEditor' => 'editor@example.com' } }; http://www.scripting.com/mp3s/weatherReportSuite.mp3 http://www.22scripting.com/mp3s/22weatherReportSuite.mp3

In reply to Re^2: XML::RSS:Parser not reading enclosure tags by Anonymous Monk
in thread XML::RSS:Parser not reading enclosure tags by Massyn

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.