比如
https://www.archlinux.org/feeds/news/
如何提出里面所有的<item>?
代码: 全选
171 my %xmlin_opts = (
172 ForceArray => [ qw/item entry/ ],
173 KeyAttr => []
174 );
175
176 $feed->{index} = XMLin($xml, %xmlin_opts) or
177 die "error reading rss file $feed->{feedfile}";
178
179 $feed = Feed->new($feed);
代码: 全选
9 'version' => '2.0',
10 'channel' => {
11 'atom:link' => {
12 'rel' => 'self',
13 'href' => 'https://www.archlinux.org/feeds/news/'
14 },
15 'lastBuildDate' => 'Mon, 08 Dec 2014 02:13:14 +0000',
16 'title' => 'Arch Linux: Recent news updates',
17 'description' => 'The latest and greatest news from the Arch Linux distribution.',
18 'item' => [
19 {
20 'title' => 'GnuPG-2.1 and the pacman keyring',
21 'dc:creator' => {
22 'content' => 'Gaetan Bisson',
当然不是所有的feed中<item>的上一层都是<channel>, 求教