title: Parse XML from K2 WCF service and display in Android, and return Html design syntax instead of XML
body: <p>I success to get httpResponse from WCF web service. However, it returns html background design syntax.
  Besides, the site is authentication restricted. I am sure I have across the https authentication with specific account.</p>
  
  <p>The site is look like : <a href="https://abc/k2services/syncrest.svc/Task/items" rel="nofollow">https://abc/k2services/syncrest.svc/Task/items</a></p>
  
  <p><strong>http connection code</strong></p>
  
  <pre><code>public String XMLUrlHttpRequest(String Url, final String userName, final String password) {
  </code></pre>
  
  <p>...</p>
  
  <pre><code>try {
  
          DefaultHttpClient httpClient =GetNewHttpClient();            
  
          //Http Request
          HttpPost httpPost = new HttpPost(Url);
          httpPost.setHeader("Host",host);
          httpPost.setHeader("Accept","application/xml");
          httpPost.setHeader("Content-Type","application/xml");
  
          //Http Response
          HttpResponse httpResponse = httpClient.execute(httpPost);
          System.out.println(httpResponse.toString());
          if (httpResponse.getStatusLine().getStatusCode() != 404) {
  
              HttpEntity httpEntity = httpResponse.getEntity();
  
              xml_string = getASCIIContentFromEntity(httpEntity);
              if(xml_string.isEmpty()){
                  Log.w("XML", "isEmpty");
              }else{
                  System.out.println(xml_string);
                  Log.w("XML", "OK");
                  Log.w("XML", xml_string);
              }
  
          }
  
  
      } catch (UnsupportedEncodingException e) {
          e.printStackTrace();
      } catch (ClientProtocolException e) {
          e.printStackTrace();
      } catch (IOException e) {
          e.printStackTrace();
      }
  
      return xml_string;
  
  }
  </code></pre>
  
  <p><strong>Parse and read XML code</strong></p>
  
  <pre><code>try {
  
              response = new ParseXML().XMLUrlHttpRequest(Url,userName,password);
          }catch(Exception e){
              Log.w("Cannot ", "Start");
          }
          String parsedData = "";
  
          try {
  
              Log.w("AndroidParseXMLActivity", "Start");
              SAXParserFactory spf = SAXParserFactory.newInstance();
              SAXParser sp = spf.newSAXParser();
              XMLReader xr = sp.getXMLReader();
  
              Datahandler XMLHandler = new Datahandler();
              xr.setContentHandler(XMLHandler);
              InputSource inStream = new InputSource();
  
              inStream.setCharacterStream(new StringReader(response));
  
              xr.parse(inStream);
              Log.w("response -----&gt;",response);
              int i=0;
              ArrayList&lt;Data&gt; DatasList = XMLHandler.getBooksList();
              //for(;i&lt;BooksList.size();i++){
              Data data = DatasList.get(1);
              parsedData = parsedData + "Detail-----&gt;\n"; // Can be shown in the application as getting httpResponse
              parsedData = parsedData + "Process Name: " + data.getProcessName() + "\n";    //&lt;---Error points to here, cause no XML content returned. No column sorted
              parsedData = parsedData + "Process FullName: " + data.getProcessFullName() + "\n";
  
  
              Log.w("i==",String.valueOf(i));
              Log.w("Data",parsedData);
  
              Log.w("populating", "Done");
          }
          catch (Exception e) {
              Log.w("ParseXML",e );
          }
  
          return parsedData;
  
      }
  </code></pre>
  
  <p><strong>Return httpResponse</strong></p>
  
  <pre><code>&lt;HTML&gt;&lt;HEAD&gt;&lt;STYLE type="text/css"&gt;#content{ FONT-SIZE: 0.7em; PADDING-BOTTOM: 2em; MARGIN-LEFT: 30px}BODY{MARGIN-TOP: 0px; MARGIN-LEFT: 0px; COLOR: #000000; FONT-FAMILY: Verdana; BACKGROUND-COLOR: white}P{MARGIN-TOP: 0px; MARGIN-BOTTOM: 12px; COLOR: #000000; FONT-FAMILY: Verdana}PRE{BORDER-RIGHT: #f0f0e0 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #f0f0e0 1px solid; MARGIN-TOP: -5px; PADDING-LEFT: 5px; FONT-SIZE: 1.2em; PADDING-BOTTOM: 5px; BORDER-LEFT: #f0f0e0 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #f0f0e0 1px solid; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e5e5cc}.heading1{MARGIN-TOP: 0px; PADDING-LEFT: 15px; FONT-WEIGHT: normal; FONT-SIZE: 26px; MARGIN-BOTTOM: 0px; PADDING-BOTTOM: 3px; MARGIN-LEFT: -30px; WIDTH: 100%; COLOR: #ffffff; PADDING-TOP: 10px; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #003366}.intro{MARGIN-LEFT: -15px}&lt;/STYLE&gt;
  &lt;TITLE&gt;Service&lt;/TITLE&gt;&lt;/HEAD&gt;&lt;BODY&gt;
  &lt;DIV id="content"&gt;
  &lt;P class="heading1"&gt;Service&lt;/P&gt;
  &lt;BR/&gt;
  &lt;P class="intro"&gt;Method not allowed.&lt;/P&gt;
  &lt;/DIV&gt;
  &lt;/BODY&gt;&lt;/HTML&gt;
  </code></pre>
  
  <p>Thanks</p>