Skip to content Skip to sidebar Skip to footer

How To Parse Xml Data From HTTPResponse In Android

i have made an activity in android,in that i have made a multipart entity request using HttpPost,Now i am getting successfull respose also.but thing is i dont know how to get those

Solution 1:

I got my answer by my way.Hello all for your responses but i got myy question solved by my way ,Actually all are telling me about different parsing but i want to know about the parsing from HTTP RESPONSE,So i have got my solution,here it is: http://www.java2s.com/Code/Android/Development/getCharacterDataFromElement.htm

Thanks for this useful post.


Solution 2:

            String xml="<yourxml></yourxml>"

            DefaultHttpClient httpClient = new DefaultHttpClient();
            HttpPost httpPost = new HttpPost(url);
            httpPost.setHeader("Content-Type", "application/xml");

            StringEntity entity = new StringEntity(xml);
            httpPost.setEntity(entity);

            HttpResponse httpResponse = httpClient.execute(httpPost);
            HttpEntity httpEntity = httpResponse.getEntity();
            xml = EntityUtils.toString(httpEntity);

Post a Comment for "How To Parse Xml Data From HTTPResponse In Android"