root/as3/Syndication/trunk/src/org/libspark/syndication/RSSFeed.as

リビジョン 985, 2.1 kB (コミッタ: nobu, コミット時期: 4 年 前)

Syndication: refs #52 #53

  • コメントを追記。
  • テストを追加。
Line 
1 /**
2  * ActionScript Syndication Library
3  *
4  * Copyright (c) 2008 Takanobu Izukawa (humming.via-kitchen.com) and
5  *                    Spark project    (www.libspark.org)
6  *
7  * Dual licensed under the MIT (MIT-LICENSE.txt)
8  * and GPL (GPL-LICENSE.txt) licenses.
9  *
10  */
11 package org.libspark.syndication
12 {
13     import org.libspark.syndication.namespaces.rss;
14     import org.libspark.syndication.namespaces.rdf;
15     import org.libspark.syndication.namespaces.dc;
16     import org.libspark.syndication.namespaces.content;
17
18     use namespace rss;
19     use namespace rdf;
20     use namespace dc;
21     use namespace content;
22
23     /**
24      *  IFeed インターフェイスの実装クラスで RSS 1.0 に対応した実装を提供します。
25      */
26     public class RSSFeed implements IFeed
27     {
28         /**
29          *  フィードのデータを保持します。
30          */
31         private var _data:XML;
32        
33         /**
34          *  @inheritDoc
35          */
36         public function get title():String
37         {
38             return _data.channel.title.toString();
39         }
40
41         /**
42          *  @inheritDoc
43          */
44         public function get link():String
45         {
46             return _data.channel.link.toString();
47         }
48
49         /**
50          *  エントリーの情報を保持します。
51          */
52         private var _entries:Array;
53        
54         /**
55          *  @inheritDoc
56          */
57         public function get entries():Array
58         {
59             if (_entries == null)
60             {
61                 _entries = [];
62                 for each (var nodeData:XML in _data.item)
63                 {
64                     _entries.push(new RSSFeedEntry(nodeData));
65                 }
66             }
67             return _entries;
68         }
69
70         /**
71          *  新しい RSSFeed クラスのインスタンスを作成します。
72          */
73         public function RSSFeed(data:XML)
74         {
75             _data = data;
76         }
77        
78         /**
79          *  @inheritDoc
80          */
81         public function toString():String
82         {
83             return title;
84         }
85     }
86 }
87
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。