Quantcast
Channel: How to get getElementsByTagNameNS content? - Stack Overflow
Viewing all articles
Browse latest Browse all 3

How to get getElementsByTagNameNS content?

$
0
0

I am trying to read and parse an RSS feed. The header of the RSS feed is the following:

<rss version="2.0" xmlns:content="http://www.mywebsite.com" xmlns:media="http://search.yahoo.com/mrss/">

I successfully retrieved both <title> and <link> from items but I can't seem to find a way to retrieve <content:encoded> childs. That's what I tryed so far:

<?php//error_reporting(E_ALL);//ini_set("display_errors", 1);....$x=$xmlDoc->getElementsByTagName('item');foreach($x as $item) {    $link = $item->getElementsByTagName('link')->item(0)->nodeValue;    $title = $item->getElementsByTagName('title')->item(0)->nodeValue;    $content = $item->getElementsByTagNameNS('http://www.mywebsite.com', 'encoded')->item(0);    echo ("<p><a href='" . $link. "'>" . $title . "</a></p><p>" . $content . "</p>");}?>

As you can imagine $content is empty even if I try to get the nodeValue attribute, what am I missing here?


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles



Latest Images