title: Fatal error: Call to a member function attributes() on a non-object
body: <p>I am trying to make my XML sitemap from Blogger feed so I tried it with the below code then its working fine.</p>
  
  <pre><code>&lt;?php
  header('application/rss+xml; charset=utf-8');
  header('Content-Type: text/xml');
  header('Pragma: public');
  header('Cache-control: private');
  header('Expires: -1');
  echo '&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;urlset
  xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
  http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"&gt;
  ';
  $sitemapONE = simplexml_load_file('http://www.exeideas.com/atom.xml?redirect=false&amp;start-index=1&amp;max-results=368');
  foreach($sitemapONE-&gt;entry as $value)
  {
  echo '
  &lt;url&gt;
  &lt;loc&gt;http://www.exeideas.com/'.$value-&gt;link[4]-&gt;attributes()-&gt;href.'&lt;/loc&gt;
  &lt;lastmod&gt;'.$value-&gt;updated.'&lt;/lastmod&gt;
  &lt;changefreq&gt;always&lt;/changefreq&gt;
  &lt;/url&gt;
  ';
  }
  echo '&lt;/urlset&gt;';
  ?&gt;
  </code></pre>
  
  <p>But when I increased my "max-results=368" To "max-results=369", I got an error as "Extra content at the end of the document" And in the end of XML page, it shows:</p>
  
  <blockquote>
    <p>( ! ) Fatal error: Call to a member function attributes() on a non-object.............</p>
  </blockquote>
  
  <p>What to do now?</p>