title: Using Xpath in php, return an empty array
body: <p>Hi guys i'm trying to get all artist from this XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;metadata created="2015-02-03T04:03:18.468Z"
      xmlns="http://musicbrainz.org/ns/mmd-2.0#"
      xmlns:ext="http://musicbrainz.org/ns/ext#-2.0"&gt;
      &lt;artist-list count="6310" offset="0"&gt;
          &lt;artist id="d51955f3-df06-432c-a90d-0308f3c48273" type="Person" ext:score="100"&gt;
              &lt;name&gt;Paul Smith&lt;/name&gt;
              &lt;sort-name&gt;Smith, Paul&lt;/sort-name&gt;
              &lt;gender&gt;male&lt;/gender&gt;
              &lt;country&gt;US&lt;/country&gt;
              &lt;area id="489ce91b-6658-3307-9877-795b68554c98"&gt;
                  &lt;name&gt;United States&lt;/name&gt;
                  &lt;sort-name&gt;United States&lt;/sort-name&gt;
              &lt;/area&gt;
              &lt;begin-area id="82f3a697-ba65-404d-a1ed-360147af7d10"&gt;
                  &lt;name&gt;San Diego&lt;/name&gt;
                  &lt;sort-name&gt;San Diego&lt;/sort-name&gt;
              &lt;/begin-area&gt;
              &lt;end-area id="ae0110b6-13d4-4998-9116-5b926287aa23"&gt;
                  &lt;name&gt;California&lt;/name&gt;
                  &lt;sort-name&gt;California&lt;/sort-name&gt;
              &lt;/end-area&gt;
              &lt;disambiguation&gt;jazz pianist, composer, arranger and bandleader&lt;/disambiguation&gt;
              &lt;life-span&gt;
                  &lt;begin&gt;1922-04-17&lt;/begin&gt;
                  &lt;end&gt;2013-06-29&lt;/end&gt;
                  &lt;ended&gt;true&lt;/ended&gt;
              &lt;/life-span&gt;
              &lt;alias-list&gt;
                  &lt;alias sort-name="Smith, Paul T."&gt;Paul T. Smith&lt;/alias&gt;
              &lt;/alias-list&gt;
          &lt;/artist&gt;
          &lt;artist id="443ead81-02ce-4136-a759-71453184c002" type="Person" ext:score="100"&gt;
              &lt;name&gt;Paul Smith&lt;/name&gt;
              &lt;sort-name&gt;Smith, Paul&lt;/sort-name&gt;
              &lt;gender&gt;male&lt;/gender&gt;
              &lt;country&gt;US&lt;/country&gt;
              &lt;area id="489ce91b-6658-3307-9877-795b68554c98"&gt;
                  &lt;name&gt;United States&lt;/name&gt;
                  &lt;sort-name&gt;United States&lt;/sort-name&gt;
              &lt;/area&gt;
              &lt;begin-area id="f83bde89-c84a-4846-a89a-d5d0874e9ddc"&gt;
                  &lt;name&gt;Calumet&lt;/name&gt;
                  &lt;sort-name&gt;Calumet&lt;/sort-name&gt;
              &lt;/begin-area&gt;
              &lt;end-area id="6db2e45d-d7f3-43da-ac0b-7ba5ca627373"&gt;
                  &lt;name&gt;Glendale&lt;/name&gt;
                  &lt;sort-name&gt;Glendale&lt;/sort-name&gt;
              &lt;/end-area&gt;
              &lt;disambiguation&gt;film and television composer, Disney Legends honoree&lt;/disambiguation&gt;
              &lt;life-span&gt;
                  &lt;begin&gt;1906-10-30&lt;/begin&gt;
                  &lt;end&gt;1985-01-25&lt;/end&gt;
                  &lt;ended&gt;true&lt;/ended&gt;
              &lt;/life-span&gt;
              &lt;alias-list&gt;
                  &lt;alias sort-name="Smith, Paul J."&gt;Paul J. Smith&lt;/alias&gt;
              &lt;/alias-list&gt;
          &lt;/artist&gt;
          &lt;artist id="fac3e6c4-6d3c-4086-a590-95e4a057ac42" ext:score="95"&gt;
              &lt;name&gt;Paul Smith&lt;/name&gt;
              &lt;sort-name&gt;Paul Smith&lt;/sort-name&gt;
              &lt;disambiguation&gt;Banjo&lt;/disambiguation&gt;
              &lt;life-span&gt;
                  &lt;ended&gt;false&lt;/ended&gt;
              &lt;/life-span&gt;
          &lt;/artist&gt;
          &lt;artist id="8ffc42c7-4083-4435-b91c-6ddf4095eeb3" ext:score="95"&gt;
              &lt;name&gt;Paul Smith&lt;/name&gt;
              &lt;sort-name&gt;Smith, Paul&lt;/sort-name&gt;
              &lt;country&gt;US&lt;/country&gt;
              &lt;area id="489ce91b-6658-3307-9877-795b68554c98"&gt;
                  &lt;name&gt;United States&lt;/name&gt;
                  &lt;sort-name&gt;United States&lt;/sort-name&gt;
              &lt;/area&gt;
              &lt;disambiguation&gt;American soul artist&lt;/disambiguation&gt;
              &lt;life-span&gt;
                  &lt;ended&gt;false&lt;/ended&gt;
              &lt;/life-span&gt;
          &lt;/artist&gt;
          &lt;artist id="2f727018-1e83-4797-8433-32c8b99dd057" type="Person" ext:score="94"&gt;
              &lt;name&gt;Paul Smith&lt;/name&gt;
              &lt;sort-name&gt;Smith, Paul&lt;/sort-name&gt;
              &lt;gender&gt;male&lt;/gender&gt;
              &lt;country&gt;GB&lt;/country&gt;
              &lt;area id="8a754a16-0027-3a29-b6d7-2b40ea0481ed"&gt;
                  &lt;name&gt;United Kingdom&lt;/name&gt;
                  &lt;sort-name&gt;United Kingdom&lt;/sort-name&gt;
              &lt;/area&gt;
              &lt;disambiguation&gt;of Maxïmo Park&lt;/disambiguation&gt;
              &lt;life-span&gt;
                  &lt;begin&gt;1979-03-13&lt;/begin&gt;
                  &lt;ended&gt;false&lt;/ended&gt;
              &lt;/life-span&gt;
          &lt;/artist&gt;
          &lt;artist id="e44ae2fa-9367-4691-bdb7-d097446ee3ce" type="Person" ext:score="94"&gt;
              &lt;name&gt;Paul Smith&lt;/name&gt;
              &lt;sort-name&gt;Smith, Paul&lt;/sort-name&gt;
              &lt;disambiguation&gt;Gabba/Acid techno artist&lt;/disambiguation&gt;
              &lt;life-span&gt;
                  &lt;ended&gt;false&lt;/ended&gt;
              &lt;/life-span&gt;
          &lt;/artist&gt;
          &lt;artist id="32c7cf45-867e-4076-a24c-ba38dccaa7bd" type="Person" ext:score="94"&gt;
              &lt;name&gt;Paul Smith&lt;/name&gt;
              &lt;sort-name&gt;Smith, Paul&lt;/sort-name&gt;
              &lt;country&gt;US&lt;/country&gt;
              &lt;area id="489ce91b-6658-3307-9877-795b68554c98"&gt;
                  &lt;name&gt;United States&lt;/name&gt;
                  &lt;sort-name&gt;United States&lt;/sort-name&gt;
              &lt;/area&gt;
              &lt;disambiguation&gt;American folk artist&lt;/disambiguation&gt;
              &lt;life-span&gt;
                  &lt;ended&gt;false&lt;/ended&gt;
              &lt;/life-span&gt;
          &lt;/artist&gt;
          &lt;artist id="bb57b210-bf27-4af1-8561-600f131bfc81" type="Person" ext:score="94"&gt;
              &lt;name&gt;Paul Smith&lt;/name&gt;
              &lt;sort-name&gt;Smith, Paul&lt;/sort-name&gt;
              &lt;disambiguation&gt;drum n bass producer aka Spinback&lt;/disambiguation&gt;
              &lt;life-span&gt;
                  &lt;ended&gt;false&lt;/ended&gt;
              &lt;/life-span&gt;
          &lt;/artist&gt;
          &lt;artist id="35287ce6-2fd4-41af-9248-d07e84eeb0df" type="Person" ext:score="94"&gt;
              &lt;name&gt;Paul Smith&lt;/name&gt;
              &lt;sort-name&gt;Smith, Paul&lt;/sort-name&gt;
              &lt;disambiguation&gt;Contemporary Christian artist peformed with The Imperials&lt;/disambiguation&gt;
              &lt;life-span&gt;
                  &lt;ended&gt;false&lt;/ended&gt;
              &lt;/life-span&gt;
          &lt;/artist&gt;
          &lt;artist id="6ece7fa3-c397-48a6-99f7-05e900b73d81" type="Person" ext:score="82"&gt;
              &lt;name&gt;Nicholas Paul Smith&lt;/name&gt;
              &lt;sort-name&gt;Smith, Nicholas Paul&lt;/sort-name&gt;
              &lt;gender&gt;male&lt;/gender&gt;
              &lt;life-span&gt;
                  &lt;ended&gt;false&lt;/ended&gt;
              &lt;/life-span&gt;
          &lt;/artist&gt;
          &lt;artist id="3c1fbcf7-4bb8-49ac-8d35-3f4ee8b71e0a" type="Person" ext:score="79"&gt;
              &lt;name&gt;Paul Smith&lt;/name&gt;
              &lt;sort-name&gt;Smith, Paul&lt;/sort-name&gt;
              &lt;gender&gt;male&lt;/gender&gt;
              &lt;country&gt;US&lt;/country&gt;
              &lt;area id="489ce91b-6658-3307-9877-795b68554c98"&gt;
                  &lt;name&gt;United States&lt;/name&gt;
                  &lt;sort-name&gt;United States&lt;/sort-name&gt;
              &lt;/area&gt;
              &lt;disambiguation&gt;recording engineer, David "Honeyboy" Edwards recordings&lt;/disambiguation&gt;
              &lt;life-span&gt;
                  &lt;ended&gt;false&lt;/ended&gt;
              &lt;/life-span&gt;
          &lt;/artist&gt;
          &lt;artist id="24e472f9-6003-4873-aac5-c79763105a51" type="Person" ext:score="79"&gt;
              &lt;name&gt;Paul Smith&lt;/name&gt;
              &lt;sort-name&gt;Smith, Paul&lt;/sort-name&gt;
              &lt;gender&gt;male&lt;/gender&gt;
              &lt;country&gt;GB&lt;/country&gt;
              &lt;area id="8a754a16-0027-3a29-b6d7-2b40ea0481ed"&gt;
                  &lt;name&gt;United Kingdom&lt;/name&gt;
                  &lt;sort-name&gt;United Kingdom&lt;/sort-name&gt;
              &lt;/area&gt;
              &lt;disambiguation&gt;UK drummer&lt;/disambiguation&gt;
              &lt;life-span&gt;
                  &lt;ended&gt;false&lt;/ended&gt;
              &lt;/life-span&gt;
          &lt;/artist&gt;
          &lt;artist id="662c9cd6-73e2-426f-8e76-a8f2a8233215" type="Person" ext:score="79"&gt;
              &lt;name&gt;Paul Smith&lt;/name&gt;
              &lt;sort-name&gt;Smith, Paul&lt;/sort-name&gt;
              &lt;country&gt;AU&lt;/country&gt;
              &lt;area id="106e0bec-b638-3b37-b731-f53d507dc00e"&gt;
                  &lt;name&gt;Australia&lt;/name&gt;
                  &lt;sort-name&gt;Australia&lt;/sort-name&gt;
              &lt;/area&gt;
              &lt;disambiguation&gt;Australian bassist for Laughing Clowns/Ed Kuepper&lt;/disambiguation&gt;
              &lt;life-span&gt;
                  &lt;ended&gt;false&lt;/ended&gt;
              &lt;/life-span&gt;
          &lt;/artist&gt;
          &lt;artist id="0e911646-290a-4345-b3dc-e5ca91faaf88" type="Person" ext:score="79"&gt;
              &lt;name&gt;Paul Smith&lt;/name&gt;
              &lt;sort-name&gt;Smith, Paul&lt;/sort-name&gt;
              &lt;gender&gt;male&lt;/gender&gt;
              &lt;country&gt;GB&lt;/country&gt;
              &lt;area id="8a754a16-0027-3a29-b6d7-2b40ea0481ed"&gt;
                  &lt;name&gt;United Kingdom&lt;/name&gt;
                  &lt;sort-name&gt;United Kingdom&lt;/sort-name&gt;
              &lt;/area&gt;
              &lt;disambiguation&gt;British a cappella singer&lt;/disambiguation&gt;
              &lt;life-span&gt;
                  &lt;ended&gt;false&lt;/ended&gt;
              &lt;/life-span&gt;
          &lt;/artist&gt;
          &lt;artist id="75ffe808-187a-4488-8c84-7467efa2b277" type="Person" ext:score="79"&gt;
              &lt;name&gt;Paul Smith&lt;/name&gt;
              &lt;sort-name&gt;Smith, Paul&lt;/sort-name&gt;
              &lt;disambiguation&gt;of Dengue Fever&lt;/disambiguation&gt;
              &lt;life-span&gt;
                  &lt;ended&gt;false&lt;/ended&gt;
              &lt;/life-span&gt;
          &lt;/artist&gt;
          &lt;artist id="79d145cb-d862-487d-a340-b723a7c8eb26" type="Person" ext:score="79"&gt;
              &lt;name&gt;Paul Smith&lt;/name&gt;
              &lt;sort-name&gt;Smith, Paul&lt;/sort-name&gt;
              &lt;country&gt;GB&lt;/country&gt;
              &lt;area id="8a754a16-0027-3a29-b6d7-2b40ea0481ed"&gt;
                  &lt;name&gt;United Kingdom&lt;/name&gt;
                  &lt;sort-name&gt;United Kingdom&lt;/sort-name&gt;
              &lt;/area&gt;
              &lt;disambiguation&gt;Scottish electronic artist performing as Reverbaphon&lt;/disambiguation&gt;
              &lt;life-span&gt;
                  &lt;ended&gt;false&lt;/ended&gt;
              &lt;/life-span&gt;
          &lt;/artist&gt;
          &lt;artist id="1f483d17-7510-44d1-95a7-8c16c53c57a1" type="Person" ext:score="79"&gt;
              &lt;name&gt;Paul Smith&lt;/name&gt;
              &lt;sort-name&gt;Smith, Paul&lt;/sort-name&gt;
              &lt;country&gt;US&lt;/country&gt;
              &lt;area id="489ce91b-6658-3307-9877-795b68554c98"&gt;
                  &lt;name&gt;United States&lt;/name&gt;
                  &lt;sort-name&gt;United States&lt;/sort-name&gt;
              &lt;/area&gt;
              &lt;disambiguation&gt;US underground hip hop MC Breeze Brewin, of Weatherman, Def Jux&lt;/disambiguation&gt;
              &lt;life-span&gt;
                  &lt;ended&gt;false&lt;/ended&gt;
              &lt;/life-span&gt;
          &lt;/artist&gt;
          &lt;artist id="76e04e2a-e440-4729-8036-59928521c677" type="Person" ext:score="79"&gt;
              &lt;name&gt;Paul Smith&lt;/name&gt;
              &lt;sort-name&gt;Smith, Paul&lt;/sort-name&gt;
              &lt;gender&gt;male&lt;/gender&gt;
              &lt;country&gt;US&lt;/country&gt;
              &lt;area id="489ce91b-6658-3307-9877-795b68554c98"&gt;
                  &lt;name&gt;United States&lt;/name&gt;
                  &lt;sort-name&gt;United States&lt;/sort-name&gt;
              &lt;/area&gt;
              &lt;disambiguation&gt;sound engineer, Randy Crawford &amp;amp; Joe Sample recordings&lt;/disambiguation&gt;
              &lt;life-span&gt;
                  &lt;ended&gt;false&lt;/ended&gt;
              &lt;/life-span&gt;
          &lt;/artist&gt;
          &lt;artist id="7a81a64e-4fdc-44a8-b33b-a447c611cf33" type="Group" ext:score="76"&gt;
              &lt;name&gt;The Paul Smith Trio&lt;/name&gt;
              &lt;sort-name&gt;Paul Smith Trio, The&lt;/sort-name&gt;
              &lt;life-span&gt;
                  &lt;ended&gt;false&lt;/ended&gt;
              &lt;/life-span&gt;
          &lt;/artist&gt;
          &lt;artist id="7b458c24-ce5b-4b77-a1dc-616ff53d1e70" type="Group" ext:score="76"&gt;
              &lt;name&gt;The Paul Smith Quartet&lt;/name&gt;
              &lt;sort-name&gt;Paul Smith Quartet, The&lt;/sort-name&gt;
              &lt;country&gt;US&lt;/country&gt;
              &lt;area id="489ce91b-6658-3307-9877-795b68554c98"&gt;
                  &lt;name&gt;United States&lt;/name&gt;
                  &lt;sort-name&gt;United States&lt;/sort-name&gt;
              &lt;/area&gt;
              &lt;life-span&gt;
                  &lt;ended&gt;false&lt;/ended&gt;
              &lt;/life-span&gt;
          &lt;/artist&gt;
          &lt;artist id="1c86fcf3-b56c-4427-856b-344d898abc33" ext:score="76"&gt;
              &lt;name&gt;Paul Gerard Smith&lt;/name&gt;
              &lt;sort-name&gt;Smith, Paul Gerard&lt;/sort-name&gt;
              &lt;life-span&gt;
                  &lt;ended&gt;false&lt;/ended&gt;
              &lt;/life-span&gt;
          &lt;/artist&gt;
          &lt;artist id="e5fcb860-3210-4721-a44f-7bd3dcb4b5d5" ext:score="76"&gt;
              &lt;name&gt;Paul Joseph Smith&lt;/name&gt;
              &lt;sort-name&gt;Paul Joseph Smith&lt;/sort-name&gt;
              &lt;life-span&gt;
                  &lt;ended&gt;false&lt;/ended&gt;
              &lt;/life-span&gt;
          &lt;/artist&gt;
          &lt;artist id="3eedd38b-f7ca-43d2-b635-adc4ad95371b" type="Person" ext:score="74"&gt;
              &lt;name&gt;Margaret Thatcher&lt;/name&gt;
              &lt;sort-name&gt;Thatcher, Margaret&lt;/sort-name&gt;
              &lt;gender&gt;female&lt;/gender&gt;
              &lt;country&gt;GB&lt;/country&gt;
              &lt;area id="8a754a16-0027-3a29-b6d7-2b40ea0481ed"&gt;
                  &lt;name&gt;United Kingdom&lt;/name&gt;
                  &lt;sort-name&gt;United Kingdom&lt;/sort-name&gt;
              &lt;/area&gt;
              &lt;life-span&gt;
                  &lt;begin&gt;1925-10-13&lt;/begin&gt;
                  &lt;end&gt;2013-04-08&lt;/end&gt;
                  &lt;ended&gt;true&lt;/ended&gt;
              &lt;/life-span&gt;
              &lt;tag-list&gt;
                  &lt;tag count="1"&gt;
                      &lt;name&gt;politician&lt;/name&gt;
                  &lt;/tag&gt;
                  &lt;tag count="1"&gt;
                      &lt;name&gt;non-musician&lt;/name&gt;
                  &lt;/tag&gt;
              &lt;/tag-list&gt;
          &lt;/artist&gt;
          &lt;artist id="646c86db-d0af-403e-bef9-3deafd9c3d43" type="Person" ext:score="74"&gt;
              &lt;name&gt;Brad Thatcher&lt;/name&gt;
              &lt;sort-name&gt;Thatcher, Brad&lt;/sort-name&gt;
              &lt;life-span&gt;
                  &lt;ended&gt;false&lt;/ended&gt;
              &lt;/life-span&gt;
          &lt;/artist&gt;
          &lt;artist id="b5425c52-3e9c-4144-9467-eaa4d69389b8" type="Person" ext:score="74"&gt;
              &lt;name&gt;Jim Thatcher&lt;/name&gt;
              &lt;sort-name&gt;Thatcher, Jim&lt;/sort-name&gt;
              &lt;life-span&gt;
                  &lt;ended&gt;false&lt;/ended&gt;
              &lt;/life-span&gt;
              &lt;alias-list&gt;
                  &lt;alias sort-name="Thatcher, James" type="Legal name"&gt;James Thatcher&lt;/alias&gt;
              &lt;/alias-list&gt;
          &lt;/artist&gt;
      &lt;/artist-list&gt;
  &lt;/metadata&gt;
  </code></pre>
  
  <p>but all that i get is an empty array.</p>
  
  <p>this is my code: </p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;body&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;title&gt;XML: Descrizione, Immagine, Link a Discogs&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;?php 
  $bb = "Paul Thatcher Smith"; //Example.
  $name = strtolower(str_replace(" ","%20",$bb)); //all whitespaces must be coded with %20
  $html = "http://musicbrainz.org/ws/2/artist/?query=".$name;
  
  if (($response_xml_data = file_get_contents($html))===false){
      echo "Error fetching XML\n";
  } 
  else {
     libxml_use_internal_errors(true);
     $data = new SimpleXmlElement($response_xml_data); //all ok, you can do an echo, xml is well formed
     $data-&gt;registerXPathNamespace('c',$html); //according to w3s
     if (!$data) { //always have this error -.-
         echo "Error loading XML\n";
         foreach(libxml_get_errors() as $error) {
             echo "\t", $error-&gt;message;
         }
     } 
     else {
          $xpath='//c:artist'; //simple xpath query, if i put //* it gives me all xml
          print_r($result = $data-&gt;xpath($xpath)); 
          foreach ($result as $artist){
              echo $artist . "&lt;br&gt;";
          }
      }
  }
  ?&gt;
  </code></pre>
  
  <p>
  </p>