I want to parse the google weather Api response..
the response is like :
now i want only temp_c data to use in my app.
so how can i get the value of temp using xml pull parser..
right now i m doing like that
StringBufferInputStream buffer = new StringBufferInputStream(response);
xpp = XmlPullParserFactory.newInstance().newPullParser();
xpp.setInput(buffer, null);
int eventType = xpp.getEventType();
while(eventType != XmlPullParser.END_DOCUMENT)
{
if(eventType == XmlPullParser.START_TAG){
String elementName = xpp.getName();
if(elementName.equals("current_conditions")){
local_pickup = xpp.nextText();
Log.d("database", local_pickup);
}
}
eventType = xpp.next();
}
buffer.close();
please help me guys as early as possible
i found a solution for this problem in the following link how to parse the value in the attribute in xml parsing
But parsing using SAX parser is more efficient for these type XML files. check this link for parsing your XML easily using SAX parser http://www.java2s.com/Code/Java/XML/SAXDemo.htm