title: prestashop : XML declaration allowed only at the start of the document
body: <p>I'm using PSWebServiceLibrary.php for prestashop and in the <code>add</code> function this is the code which send the xml request for parsning. I have </p>
  
  <pre><code>        self::checkStatusCode($request['status_code']);
          $res = trim($request['response'] ); 
          var_dump($res);
          return self::parseXML($request['response']);
  </code></pre>
  
  <p>And this is the output of var_dump :</p>
  
  <pre><code>string(1459) "&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;prestashop xmlns:xlink="http://www.w3.org/1999/xlink"&gt;
  &lt;customer&gt;
      &lt;id&gt;&lt;![CDATA[220]]&gt;&lt;/id&gt;
      &lt;id_default_group&gt;&lt;/id_default_group&gt;
      &lt;id_lang xlink:href="http://elpakhsh.com/api/languages/2"&gt;&lt;![CDATA[2]]&gt;&lt;/id_lang&gt;
      &lt;newsletter_date_add&gt;&lt;![CDATA[2017-07-12 10:50:46]]&gt;&lt;/newsletter_date_add&gt;
      &lt;ip_registration_newsletter&gt;&lt;/ip_registration_newsletter&gt;
      &lt;last_passwd_gen&gt;&lt;![CDATA[2017-07-12 04:50:46]]&gt;&lt;/last_passwd_gen&gt;
      &lt;secure_key&gt;&lt;![CDATA[95bb810ab3d387bc7eb249030ec06233]]&gt;&lt;/secure_key&gt;
      &lt;deleted&gt;&lt;/deleted&gt;
      &lt;passwd&gt;&lt;![CDATA[e95db4822affea261aad478059f75457]]&gt;&lt;/passwd&gt;
      &lt;lastname&gt;&lt;![CDATA[مشتری]]&gt;&lt;/lastname&gt;
      &lt;firstname&gt;&lt;![CDATA[مشتری]]&gt;&lt;/firstname&gt;
      &lt;email&gt;&lt;![CDATA[navid.abutorab@gmail.com]]&gt;&lt;/email&gt;
      &lt;id_gender&gt;&lt;/id_gender&gt;
      &lt;birthday&gt;&lt;/birthday&gt;
      &lt;newsletter&gt;&lt;![CDATA[1]]&gt;&lt;/newsletter&gt;
      &lt;optin&gt;&lt;![CDATA[1]]&gt;&lt;/optin&gt;
      &lt;website&gt;&lt;/website&gt;
      &lt;company&gt;&lt;/company&gt;
      &lt;siret&gt;&lt;/siret&gt;
      &lt;ape&gt;&lt;/ape&gt;
      &lt;outstanding_allow_amount&gt;&lt;/outstanding_allow_amount&gt;
      &lt;show_public_prices&gt;&lt;/show_public_prices&gt;
      &lt;id_risk&gt;&lt;/id_risk&gt;
      &lt;max_payment_days&gt;&lt;/max_payment_days&gt;
      &lt;active&gt;&lt;![CDATA[1]]&gt;&lt;/active&gt;
      &lt;note&gt;&lt;/note&gt;
      &lt;is_guest&gt;&lt;/is_guest&gt;
      &lt;id_shop&gt;&lt;![CDATA[1]]&gt;&lt;/id_shop&gt;
      &lt;id_shop_group&gt;&lt;![CDATA[1]]&gt;&lt;/id_shop_group&gt;
      &lt;date_add&gt;&lt;![CDATA[2017-07-12 10:50:46]]&gt;&lt;/date_add&gt;
      &lt;date_upd&gt;&lt;![CDATA[2017-07-12 10:50:46]]&gt;&lt;/date_upd&gt;
  &lt;associations&gt;
  &lt;groups nodeType="group" api="groups"/&gt;
  &lt;/associations&gt;
  &lt;/customer&gt;
  &lt;/prestashop&gt;"
  </code></pre>
  
  <p>As you can see from the output, There is no whitespace at the beginning but I still got the error that says </p>
  
  <blockquote>
    <p>HTTP XML response is not parsable: array ( 0 =>
    LibXMLError::__set_state(array( 'level' => 3, 'code' => 64, 'column'
    => 7, 'message' => 'XML declaration allowed only at the start of the document ', 'file' => '', 'line' => 1, )), )</p>
  </blockquote>
  
  <p>What's the problem?is there anything wrong with my xml ??I have validate it and it got no problem ..</p>