title: Send XML for POST-request in Android
body: <p>In my code I let users fill in a form and I save that form in a XML file on the SD-card.</p>
  
  <p>Now I need to send the information on the XML-file as POSTdata to a server.</p>
  
  <p>How can I do that.</p>
  
  <p>I already searched the internet and found some sample-code, but I don't know how to add the XML file located on my SD-card.</p>
  
  <pre><code>public void sendtoRoutemobiel() {
      HttpClient httpclient = new DefaultHttpClient();
      HttpPost httppost = new HttpPost("http://mysite/");
  
      try {
          List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(2); //&lt;-- need to replace this with
          nameValuePairs.add(new BasicNameValuePair("id", "12345"));            //&lt;-- the data on the XML-file 
          httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));         //&lt;-- (I think)
  
          HttpResponse response;
          response = httpclient.execute(httppost);
          String temp1 = EntityUtils.toString(response.getEntity());
          Log.d("Gabug", "Response: " + temp1);
      } catch (ClientProtocolException e) {
          e.printStackTrace();
      } catch (IOException e) {
          e.printStackTrace();
      }
  }
  </code></pre>