I am trying to get xml from Web Services and I am storing it in string. I need to print this xml in Log cat but it is not coming in proper way. code is :
MainActivity.java
public class MainActivity extends Activity {
    static final String URL = myUrlOfLocalHost;
    // XML node keys
    static final String KEY_ITEM = "item"; // parent node
    static final String KEY_ID = "id";
    static final String KEY_NAME = "name";
    static final String KEY_COST = "cost";
    static final String KEY_DESC = "description";
    private String xml;
    @SuppressLint("NewApi")
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        AsyncTaskRunner runner = new AsyncTaskRunner();
        runner.execute();
    }
    class AsyncTaskRunner extends AsyncTask<String, String, String> {
        @SuppressLint("NewApi")
        @Override
        protected String doInBackground(String... params) {
            publishProgress("Sleeping..."); // Calls onProgressUpdate()
            ArrayList<HashMap<String, String>> menuItems = new ArrayList<HashMap<String, String>>();
            XMLParser parser = new XMLParser();
            xml = parser.getXmlFromUrl(URL); // getting XML
            //Document doc = parser.getDomElement(xml); // getting DOM element
            Log.e("String Data : " , xml);
return null;
}
XMLParser.java
public class XMLParser {
    private StringBuffer result ;
    //Method to get XML from reuested URL
    public String getXmlFromUrl(String url) {
        try {
            // defaultHttpClient
            DefaultHttpClient httpClient = new DefaultHttpClient();
            HttpPost httpPost = new HttpPost(url);
            HttpResponse httpResponse = httpClient.execute(httpPost);
            HttpEntity httpEntity = httpResponse.getEntity();
            //xml = EntityUtils.toString(httpEntity);
            InputStream in = httpEntity.getContent();
            BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8"),8);
            StringBuffer sb = new StringBuffer();
            String line = null;
            while ((line = reader.readLine()) != null)
            {
                // sb.append(line);
                result =  sb.append(line);;
            }
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        // return XML complete
        return result.toString();
    }
please suggest any solution as output in logcat is coming like below :
<pre class="cake-error"><a href="javascript:void(0);" onclick="document.getElementById('cakeErr5265202999359-trace').style.display = (document.getElementById('cakeErr5265202999359-trace').style.display == 'none' ? '' : 'none');"><b>Notice</b> (8)</a>: Undefined variable: school [<b>APP\View\Schools\xml\get_school_details.ctp</b>, line <b>1</b>]<div id="cakeErr5265202999359-trace" class="cake-stack-trace" style="display: none;"><a href="javascript:void(0);" onclick="document.getElementById('cakeErr5265202999359-code').style.display = (document.getElementById('cakeErr5265202999359-code').style.display == 'none' ? '' : 'none')">Code</a> <a href="javascript:void(0);" onclick="document.getElementById('cakeErr5265202999359-context').style.display = (document.getElementById('cakeErr5265202999359-context').style.display == 'none' ? '' : 'none')">Context</a><pre id="cakeErr5265202999359-code" class="cake-code-dump" style="display: none;"><span class="code-highlight"><code><span style="color: #000000"><span style="color: #0000BB"><?php $xml </span><span style="color: #007700">= </span><span style="color: #0000BB">Xml</span><span style="color: #007700">::</span><span style="color: #0000BB">fromArray</span><span style="color: #007700">(array(</span><span style="color: #0000BB">$school</span><span style="color: #007700">));</span></span></code></span></pre><pre id="cakeErr5265202999359-context" class="cake-context" style="display: none;">$viewFile = 'C:\wamp\www\School App\app\View\Schools\xml\get_school_details.ctp'$dataForView = array()</pre><pre class="stack-trace">include - APP\View\Schools\xml\get_school_details.ctp, line 1View::_evaluate() - CORE\Cake\View\View.php, line 931View::_render() - CORE\Cake\View\View.php, line 893View::render() - CORE\Cake\View\View.php, line 462XmlView::render() - CORE\Cake\View\XmlView.php, line 104Controller::render() - CORE\Cake\Controller\Controller.php, line 952Dispatcher::_invoke() - CORE\Cake\Routing\Dispatcher.php, line 194Dispatcher::dispatch() - CORE\Cake\Routing\Dispatcher.php, line 162[main] - APP\webroot\index.php, line 110</pre></div></pre><?xml version="1.0" encoding="UTF-8"?><response>  <code>500</code>  <url>/School%20App/schools/getSchoolDetails.xml?school_id=1</url>  <name>The key of input must be alphanumeric</name></response>
On Server Side method (code) used is :
public function getSchoolDetails() {
    if ($this->RequestHandler->isXml() && $this->request->is('get')) {
        $this->School->unBindModel(array('hasMany' => array('Admin', 'Announcement', 'Batch', 'Class1', 'Event', 'Lunchmenu', 'Student', 'Timetable', 'SpecialInstruction'),                                         'hasAndBelongsToMany' => array('Subject')));
        $fields = array('School.id, School.school_name, School.logo, School.phone');
        $school = $this->School->find('first', array('fields' => $fields, 'conditions' => array('School.id' => $_GET['school_id'])));
        $this->set(array(
            'school' => $school,
        '_serialize' => array('school')
        ));
    }
}
 
    