title: SimpleXML can't get CDATA with ns prefixes
body: <p>I've been struggling  to get CDATA from an xml file for the past few hours, even though I've tried different methods shown <a href="https://stackoverflow.com/questions/2970602/php-how-to-handle-cdata-with-simplexmlelement">here</a>, <a href="https://stackoverflow.com/questions/11527447/cannot-parse-cdata-with-simplexml">here</a>, and <a href="http://php.net/manual/en/function.simplexml-load-string.php#84365" rel="nofollow noreferrer">here</a>.</p>
  
  <p>My dilemma has to do with retrieving thread data through xenForo's RSS feeds. Here is a sample of the RSS data I'm trying to retrieve, everything works fine except for retrieving the <code>&lt;content:encoded&gt;</code>.</p>
  
  <p>Sample file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"&gt;
    &lt;channel&gt;
      &lt;title&gt;News &amp;amp; Announcements&lt;/title&gt;
      &lt;description&gt;All of our important news and announcements will be here.&lt;/description&gt;
      &lt;pubDate&gt;Fri, 26 Jun 2015 14:54:20 +0000&lt;/pubDate&gt;
      &lt;lastBuildDate&gt;Fri, 26 Jun 2015 14:54:20 +0000&lt;/lastBuildDate&gt;
      &lt;generator&gt;********* ****&lt;/generator&gt;
      &lt;link&gt;https://***.****.****/forum/news/&lt;/link&gt;
      &lt;atom:link rel="self" type="application/rss+xml" href="https://***.****.****/forum/news/index.rss"/&gt;
      &lt;item&gt;
        &lt;title&gt;Site under development.&lt;/title&gt;
        &lt;pubDate&gt;Thu, 25 Jun 2015 05:49:43 +0000&lt;/pubDate&gt;
        &lt;link&gt;https://***.****.****/threads/site-under-development.3/&lt;/link&gt;
        &lt;guid&gt;https://***.****.****/threads/site-under-development.3/&lt;/guid&gt;
        &lt;author&gt;invalid@example.com (*****)&lt;/author&gt;
        &lt;dc:creator&gt;ShortCut Central&lt;/dc:creator&gt;
        &lt;content:encoded&gt;&lt;![CDATA[Content to retrieve. &lt;br /&gt; Some more content a part of the same section]]&gt;&lt;/content:encoded&gt;
      &lt;/item&gt;
    &lt;/channel&gt;
  &lt;/rss&gt;
  </code></pre>
  
  <p>My current code looks like</p>
  
  <pre><code>&lt;?php
  class SCC_Main_miscFuncs {
      public static function printMostRecentPost() {
          // Re-enable the below once we're ready to release
          //$rssUrl = func_get_arg(1);
          $rssUrl = 'https://www.shortcutcentral.org/indev.rss';
          $xml = simplexml_load_string(self::returnContents($rssUrl));
          $rawData = self::returnContents($rssUrl); // Properly contains the CDATA
          echo '&lt;pre&gt;';
          //echo (string) $xml-&gt;channel-&gt;item-&gt;encoded;
          //echo (string) $xml-&gt;channel-&gt;item-&gt;content;
          //var_dump($xml);
          echo '&lt;/pre&gt;';
          //echo (string) $xml-&gt;channel-&gt;item;
          //echo $array[@attributes]['item']['link'];
          //echo $xml-&gt;message;
      }
  
      public static function returnContents($url){
          $curl_handle=curl_init();
          curl_setopt($curl_handle, CURLOPT_URL,$url);
          curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
          curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
          curl_setopt($curl_handle, CURLOPT_USERAGENT, 'ShortCut Central');
          $query = curl_exec($curl_handle);
          curl_close($curl_handle);
          return $query;
      }
  } 
  </code></pre>
  
  <p>Nothing seems to show the said CDATA except for the unparsed $rawData. I feel it might be because I'm not calling it properly (being completely new to XML and namespaces and namespace prefixes), but it not showing up through var_dump is giving me... hell. I saw some earlier posts about using XML children, but I don't entirely understand that concept, which is why, if my solution requires XML children, an explanation would be greatly appreciated.</p>
  
  <p>Thank you!</p>
  
  <p>Also might be worth mentioning that my php code is organized in the way that it is (classes and public, static functions) so that I can use it as an add-on for xenForo.</p>