read xml file in android having no attributes

splico123

New Member
i am trying to parse the weather from an xml file into my application. a am done with every thing just now i dnt knw how can i parse the value of tag having no attribute. i am trying to parse the two vlaues one is city an other is weather. here is my xml an the piece of code that i can not solve any further please help me in this regard. \[code\] <data> <request> <type>citystate</type> <query>peshawar,pakistan</query> </request> <current_condition> <observation_time>07:23 PM</observation_time> <temp_C>10</temp_C> <temp_F>50</temp_F> <weatherCode>113</weatherCode> <weatherIconUrl>\[/code\]an there is my incomplete piece of code \[code\] public class HandlingXmlStuff extends DefaultHandler {XmlDataCollected info=new XmlDataCollected();public String getInformation(){ return info.dataToString();}@Overridepublic void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { // TODO Auto-generated method stub if(localName.equals("query")) { String city= info.setCity(city); } else if(localName.equals("temp_f")) { String t=attributes.getValue(null); int temp=Integer.parseInt(t); info.settemp(temp); } } }\[/code\]
 
Back
Top