simple XMLで名前空間を取得する方法
04/21
PHPでXMLパースを使っている時にsimple XMLで文字列やデータを取得していると名前空間のタグ取得できなかった。
調べてみると・・・
属性を取得する場合は・・・
$feed->entry->title->attributes()->type; //type属性を取得 //<title type="text">【自民党ネットCM】ラーメン篇</title>
名前空間の場合・・・
$feed->entry->children('yt',true)->recorded;
//名前空間のある要素を取得
//<yt:recorded>2009-08-21</yt:recorded>
何気に困ったので、メモ。
Twitter
RSS