How do I get the values of id, created_at and updated at from an XML response after creating a new record on a web server.
The web server responds with an xml response as follows
<mobile-user>
<active type="boolean">true</active>
<created-at type="datetime">2011-10-14T14:20:51Z</created-at>
<id type="integer">4</id>
<quiz-id type="integer">0</quiz-id>
<updated-at type="datetime">2011-10-14T14:20:51Z</updated-at>
</mobile-user>
The code I use to create the record on the android app (inside an intent service) looks like this
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(NEW_USER_URL);
StringBuilder sb = new StringBuilder();
try {
sb.append("<mobile_user>");
sb.append("<auth>");
sb.append(regId);
sb.append("</auth>");
sb.append("<quiz_id>");
sb.append("1");
sb.append("</quiz_id>");
sb.append("</mobile_user>");
StringEntity entity = new StringEntity(sb.toString(), "UTF-8");
httppost.setEntity(entity);
httppost.addHeader("Accept", "application/xml");
httppost.addHeader("Content-Type", "application/xml");
HttpResponse response = httpclient.execute(httppost);
String responseXml = EntityUtils.toString(response.getEntity());
...
So I assume (correctly?) that responseXml string contains the xml response above All I need to do now is as efficiently as possible extract the id, created_at and updated_at values from that string into a new string for each value.
Any help appreciated