title: How to get attribute of node with namespace using SimpleXML?
body: <p><strong>youtube.xml</strong></p>
  
  <pre><code>&lt;feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:gd="http://schemas.google.com/g/2005" xmlns:yt="http://gdata.youtube.com/schemas/2007"&gt;  
  
      &lt;entry&gt;
          ...
          &lt;yt:duration seconds="1870"/&gt;
          ...
      &lt;/entry&gt;
  
  &lt;/feed&gt;
  </code></pre>
  
  <p><strong>update_videos.php</strong></p>
  
  <pre><code>$source = 'youtube.xml';
  
  // load as file
  $youtube = new SimpleXMLElement($source, null, true);
  
  foreach($youtube-&gt;entry as $item){
      //title works
      echo $item-&gt;title;
  
      //now how to get seconds? My attempt...
      $namespaces = $item-&gt;getNameSpaces(true);
      $yt = $item-&gt;children($namespaces['yt']);
      $seconds = $yt-&gt;duration-&gt;attributes();
      echo $seconds['seconds'];
      //but doesn't work :(
  }   
  </code></pre>