title: How to parse html inside xml's tag
body: <p>I need help in getting data from <code>description</code> tag where it consists of <code>&lt;a&gt;</code>, <code>&lt;img&gt;</code>and some text. The xml I am trying to parse is <a href="http://timesofindia.indiatimes.com/rssfeeds/2886704.cms" rel="nofollow noreferrer">this</a> </p>
  
  <p>I managed to get all the data I need, except for <code>description</code> tag where I got <code>&lt;a&gt;</code> tag along with description text. What I need is <code>img</code>'s src and the description text.</p>
  
  <p>My code :</p>
  
  <pre><code>foreach ($rss-&gt;getElementsByTagName('item') as $node) {
          /*$test = $node-&gt;getElementsByTagName('description');
          $test = $test-&gt;item(0)-&gt;textContent;*/
          var_dump($test);
          exit;
           $nodes = $node-&gt;getElementsByTagName('content');
  
  
           if(!is_object($nodes) || $nodes === null || $nodes-&gt;length==0){
  
                  $linkthumbNode = $node-&gt;getElementsByTagName('image');
  
  
                  if(isset($linkthumbNode) &amp;&amp; $linkthumbNode-&gt;length &gt;0){
                          $linkthumb=$linkthumbNode-&gt;item(0)-&gt;nodeValue;
  
                          if(empty($linkthumb)||$linkthumb == " "){
  
  
                              $linkthumb = $linkthumbNode-&gt;item(0)-&gt;getAttribute('src');
  
                          }
  
                      }else{
  
                          $linkthumb = "NO IMAGE";
                   }
  
           }else{
  
               $linkthumb = $nodes-&gt;item(0)-&gt;getAttribute('url');
           }
  
           $title = $node-&gt;getElementsByTagName('title')-&gt;item(0)-&gt;nodeValue;
           $desc = $node-&gt;getElementsByTagName('description')-&gt;item(0)-&gt;textContent;
           $link = $node-&gt;getElementsByTagName('link')-&gt;item(0)-&gt;nodeValue;
           $img = $linkthumb;
           $date = $node-&gt;getElementsByTagName('pubDate');
           if(isset($date) &amp;&amp; $date-&gt;length &gt;0){
              $date = $date-&gt;item(0)-&gt;nodeValue;
           }else{
              $date = "no date provided";
  
           }
  
  
          $item = array ( 
              'title' =&gt; $title,
              'desc' =&gt;  $desc,
              'link' =&gt; $link,
              'img' =&gt; $img,
              'date' =&gt; $date,
              );
          array_push($feed, $item);
      }
  </code></pre>
  
  <p>the xml description tag is :</p>
  
  <pre><code>&lt;description&gt;
  &lt;a href="http://timesofindia.indiatimes.com/life-style/health-fitness/diet/9-food-combos-to-make-you-lean/articleshow/20984744.cms"&gt;&lt;img border="0" hspace="10" align="left" style="margin-top:3px;margin-right:5px;" src="http://timesofindia.indiatimes.com/photo/20984744.cms" /&gt;&lt;/a&gt;Nine food combinations that will make staying healthy and looking fit easier
  &lt;/description&gt;
  </code></pre>
  
  <p>what I need: <code>http://timesofindia.indiatimes.com/photo/20984744.cms</code> as image  and <code>Nine food combinations that will make staying healthy and looking fit easier</code> as my description.</p>
  
  <p>Can someone help me? I'm not that great at PHP and parsing XML.</p>