<dc:subject>が配列でなくて、結合された文字列として扱われる。
PHP4でRSSを扱いたかったので、とりあえずMagpieRSSを選択。そしたらこの問題にぶつかったんだけど、どうしたものか。ソースを眺めると、テキストを問答無用で連結してる雰囲気。なので、強引に要素名を見て連結するのか配列に追加するのか判断するようにしてみた。ちゃんと考えた訳ではないので、いずれぼろが出る予感。。。
define("MAGPIE_MULTIPLE_ELEMENT", "subject");
--- rss_parse.inc.orig 2006-10-21 18:06:26.000000000 +0900 +++ rss_parse.inc 2006-10-21 18:02:58.000000000 +0900 @@ -339,8 +339,16 @@ if ( $this->current_namespace ) { if ( $this->initem ) { - $this->concat( - $this->current_item[ $this->current_namespace ][ $el ], $text); + if (defined("MAGPIE_MULTIPLE_ELEMENT") and + in_array($el, explode(",", MAGPIE_MULTIPLE_ELEMENT))) { + if (!is_array($this->current_item[ $this->current_namespace ][ $el ])) { + $this->current_item[ $this->current_namespace ][ $el ] = array(); + } + $this->current_item[ $this->current_namespace ][ $el ][] = $text; + } else { + $this->concat( + $this->current_item[ $this->current_namespace ][ $el ], $text); + } } elseif ($this->inchannel) { $this->concat(
PHP4で使える、名前空間に対応したいい感じのRSS(XML)パーサって他に何があるんだろう?PHP4で困るならPerlとかRubyとか使った方がいいのかな。

