title: XML Premature end of data
body: <p>when running the code below I get the following errors:</p>
  
  <p>Failed loading XML Premature end of data in tag Request line 2 </p>
  
  <p>Fatal error: Call to a member function asXml() on a non-object in /home4/viptrav3/public_html/wp-content/themes/voyage-child/transfer.php on line 61</p>
  
  <p>Line 61 is <code>$requestFile-&gt;asXml('trequest.xml');</code></p>
  
  <p>But I don't see the premature closing of the XML. I want to save this as a XML file trequest.xml</p>
  
  <pre><code>//Build XML Request
                  $requestData = '&lt;?xml version="1.0" encoding="UTF-8" ?&gt;' . "\n";
                  $requestData .= '&lt;Request&gt;';
  
                  // Create Request Header
                  $requestData .= '&lt;Source&gt;';
  
                  // Add Requestor ID data
                  $requestData .= '&lt;RequestorID Client="' . $clientID . '" EMailAddress="' . $email . '" Password="' . $password . '" /&gt;';
  
                  // Add Requestor Preferences data
                  $requestData .= '&lt;RequestorPreferences Language="' . $language . '" Currency="USD" Country="US" &gt;';
                  $requestData .= '&lt;RequestMode&gt;' . $requestMode . '&lt;/RequestMode&gt;';
                  $requestData .= '&lt;/RequestorPreferences&gt;';
                  $requestData .= '&lt;/Source&gt;';
  
                  // Create Request Body
                  $requestData .= '&lt;RequestDetails&gt;
                                  &lt;SearchTransferPriceRequest&gt;
                                  &lt;TransferPickUp&gt;
                                  &lt;PickUpCityCode&gt;LON&lt;/PickUpCityCode&gt;
                                  &lt;PickUpCode&gt;A&lt;/PickUpCode&gt;
                                  &lt;PickUpPointCode&gt;LCY&lt;/PickUpPointCode&gt;
                                  &lt;/TransferPickUp&gt;
                                  &lt;TransferDropOff&gt;
                                  &lt;DropOffCityCode&gt;EDI&lt;/DropOffCityCode&gt;
                                  &lt;DropOffCode&gt;H&lt;/DropOffCode&gt;
                                  &lt;/TransferDropOff&gt;
                                  &lt;TransferDate&gt;
                                  2013-11-11&lt;/TransferDate&gt;
                                  &lt;NumberOfPassengers&gt;2&lt;/NumberOfPassengers&gt;
                                  &lt;PreferredLanguage&gt;E&lt;/PreferredLanguage&gt;
                                  &lt;/SearchTransferPriceRequest&gt;
                                  &lt;/RequestDetails&gt;';                    
  //Save Request &amp; Display XML errors
  
                  libxml_use_internal_errors(true);
                  $sxe = simplexml_load_string($requestData);
                  if ($sxe === false) {
                      echo "Failed loading XML\n";
                      foreach(libxml_get_errors() as $error) {
                          echo "\t", $error-&gt;message;
                      }
                  }
  
  
                  $requestFile = simplexml_load_string($requestData);
                  $requestFile-&gt;asXml('trequest.xml');
  </code></pre>