Code example for XmlPullParser

Methods: getEventType, getName, nextTag, nextText

0
		} 
		//Log.d("fox", "End element: " + name); 
		 
	} 
	private void processStartElement(XmlPullParser xpp) throws XmlPullParserException, IOException {
		String name = xpp.getName();
		if(name.equalsIgnoreCase(TAG_DAY)){
			dayListItem = new HashMap<String, String>();
			dayTasks = new HashMap<String, Long>();
		} 
		else if(name.equalsIgnoreCase(TAG_DATE)){
			dayListItem.put(TAG_DATE, safeNextText(xpp));
		} 
		else if(name.equalsIgnoreCase(TAG_UTIL)){
			dayListItem.put(TAG_UTIL, safeNextText(xpp));
		}else if(name.equals(TAG_NAME)){
			key = safeNextText(xpp);
		}else if(name.equals(TAG_TIME)){
			dayTasks.put(key, Long.valueOf(safeNextText(xpp)));
		} 
		//Log.d("fox", "Start element: " + name); 
	} 
	 
	  private String safeNextText(XmlPullParser parser)
	          throws XmlPullParserException, IOException { 
	      String result = parser.nextText();
	      if (parser.getEventType() != XmlPullParser.END_TAG) {
	          parser.nextTag();
	      } 
	      return result;
	  } 
 
	private static final String ns = null;