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