Can't fix the error: Object of class DOMNodeList could not be converted to string
<p>I am trying to display XML with all the content but I keep getting this error:</p>

<blockquote>
  <p>Catchable fatal error: Object of class DOMNodeList could not be converted to string in C:\xampp\htdocs\bollywood\rss1.php on line 43</p>
</blockquote>

<p>Please help me understand what I am doing wrong.</p>

<p>XML Code:</p>

<pre><code>  &lt;channel&gt;&lt;title&gt;Entertainment News&lt;/title&gt;
  &lt;link&gt;http://www.yournewssite.com&lt;/link&gt;
   &lt;description&gt;All the latest news and gossip&lt;/description&gt;
   &lt;item&gt;
   &lt;title&gt;title!!&lt;/title&gt;
  &lt;link&gt;http://www.yournewssite.com&lt;/link&gt;
  &lt;description&gt;&lt;![CDATA[&lt;img src=http://yourwebsite.com/i.php?k=d88d4e2b336966b538983783230051c width=100 height=100&gt;
  &lt;BR&gt;Backstreet Boys, *NSYNC, 98 Degrees and O-Town boy band members have collaborated on a song to promote their new movie. &lt;BR&gt;]]&gt;
  &lt;/description&gt;
  &lt;ContentItem Href="http://yourwebiste.com/i.php?k=d88d4e2b336966b538983783230051c7"&gt;
  &lt;MediaType FormalName="Picture" /&gt;
  &lt;MimeType FormalName="image/jpg" /&gt;
  &lt;Property FormalName="caption" value="Nick Carter" /&gt;
  &lt;/ContentItem&gt;
</code></pre>

<p>And this is my PHP code:</p>

<pre><code> &lt;?php

 $q=$_GET["q"];


 if($q=="Google") {
 $xml=("google.xml");
 } elseif($q=="b") {
 $xml=("sample.xml");
 }

 $xmlDoc = new DOMDocument();
 $xmlDoc-&gt;load($xml);



//get elements from "&lt;channel&gt;"
$channel=$xmlDoc-&gt;getElementsByTagName('channel')-&gt;item(0);
$channel_title = $channel-&gt;getElementsByTagName('title')-&gt;item(0)-&gt;childNodes-&gt;item(0)-&gt;nodeValue;
$channel_link = $channel-&gt;getElementsByTagName('link')-&gt;item(0)-&gt;childNodes-&gt;item(0)-&gt;nodeValue;
$channel_desc = $channel-&gt;getElementsByTagName('description')-&gt;item(0)-&gt;childNodes-&gt;item(0)-&gt;nodeValue;

//output elements from "&lt;channel&gt;"
echo("&lt;p&gt;&lt;a href='" . $channel_link
. "'&gt;" . $channel_title . "&lt;/a&gt;");
echo("&lt;br&gt;");
echo($channel_desc . "&lt;/p&gt;");

$xpath = new DOMXpath($xmlDoc);
$nodeLists = $xpath-&gt;query('ContentItem[@Href=""]');

//get and output "&lt;item&gt;" elements
$x=$xmlDoc-&gt;getElementsByTagName('item');
for ($i=0; $i&lt; $x-&gt;length; $i++) {

    $item_title=$x-&gt;item($i)-&gt;getElementsByTagName('title')-&gt;item(0)-&gt;childNodes-&gt;item(0)-&gt;nodeValue;
 $item_link=$x-&gt;item($i)-&gt;getElementsByTagName('link')-&gt;item(0)-&gt;childNodes-&gt;item(0)-&gt;nodeValue;
   $item_desc=html_entity_decode($x-&gt;item($i)-&gt;getElementsByTagName('description')-&gt;item(0)-&gt;childNodes-&gt;item(0)-&gt;nodeValue);
    $item_ContentItem=$xpath-&gt;$nodeLists-&gt;item(0)-&gt;childNodes-&gt;item(0)-&gt;nodeValue;
   echo ("&lt;p&gt;&lt;a href=''" . $item_link
  . "'&gt;" . $item_title . "&lt;/a&gt;");
  echo ("&lt;br&gt;");
  echo ($item_desc);
  echo ("&lt;br&gt;");
  echo var_dump($item_ContentItem);
  }


  ?&gt; 
</code></pre>

<p>This is LINE 43, where I keep getting error: </p>

<pre><code>$item_ContentItem=$xpath-&gt;$nodeLists-&gt;item(0)-&gt;childNodes-&gt;item(0)-&gt;nodeValue;
</code></pre>

<p>Please help, I would really appreciate it. </p>