| 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.dc; |
|---|
| 14 |
import org.libspark.syndication.namespaces.content; |
|---|
| 15 |
|
|---|
| 16 |
use namespace dc; |
|---|
| 17 |
use namespace content; |
|---|
| 18 |
|
|---|
| 19 |
/** |
|---|
| 20 |
* IFeed インターフェイスの実装クラスで RSS 2.0 に対応した実装を提供します。 |
|---|
| 21 |
*/ |
|---|
| 22 |
public class RSS2Feed implements IFeed |
|---|
| 23 |
{ |
|---|
| 24 |
/** |
|---|
| 25 |
* フィードのデータを保持します。 |
|---|
| 26 |
*/ |
|---|
| 27 |
private var _data:XML; |
|---|
| 28 |
|
|---|
| 29 |
/** |
|---|
| 30 |
* @inheritDoc |
|---|
| 31 |
*/ |
|---|
| 32 |
public function get title():String |
|---|
| 33 |
{ |
|---|
| 34 |
return _data.channel.title.toString(); |
|---|
| 35 |
} |
|---|
| 36 |
|
|---|
| 37 |
/** |
|---|
| 38 |
* @inheritDoc |
|---|
| 39 |
*/ |
|---|
| 40 |
public function get link():String |
|---|
| 41 |
{ |
|---|
| 42 |
return _data.channel.link.toString(); |
|---|
| 43 |
} |
|---|
| 44 |
|
|---|
| 45 |
/** |
|---|
| 46 |
* エントリーの情報を保持します。 |
|---|
| 47 |
*/ |
|---|
| 48 |
private var _entries:Array; |
|---|
| 49 |
|
|---|
| 50 |
/** |
|---|
| 51 |
* @inheritDoc |
|---|
| 52 |
*/ |
|---|
| 53 |
public function get entries():Array |
|---|
| 54 |
{ |
|---|
| 55 |
if (_entries == null) |
|---|
| 56 |
{ |
|---|
| 57 |
_entries = []; |
|---|
| 58 |
for each (var nodeData:XML in _data.channel.item) |
|---|
| 59 |
{ |
|---|
| 60 |
_entries.push(new RSS2FeedEntry(nodeData)); |
|---|
| 61 |
} |
|---|
| 62 |
} |
|---|
| 63 |
return _entries; |
|---|
| 64 |
} |
|---|
| 65 |
|
|---|
| 66 |
/** |
|---|
| 67 |
* 新しい RSS2Feed クラスのインスタンスを作成します。 |
|---|
| 68 |
* |
|---|
| 69 |
* @param data rss 2.0 フィードの XML |
|---|
| 70 |
*/ |
|---|
| 71 |
public function RSS2Feed(data:XML) |
|---|
| 72 |
{ |
|---|
| 73 |
_data = data; |
|---|
| 74 |
} |
|---|
| 75 |
|
|---|
| 76 |
/** |
|---|
| 77 |
* @inheritDoc |
|---|
| 78 |
*/ |
|---|
| 79 |
public function toString():String |
|---|
| 80 |
{ |
|---|
| 81 |
return title; |
|---|
| 82 |
} |
|---|
| 83 |
} |
|---|
| 84 |
} |
|---|
| 85 |
|
|---|