Here you can find the source of nextDateTime(XmlPullParser parser, String tag)
public static DateTime nextDateTime(XmlPullParser parser, String tag) throws XmlPullParserException, IOException
//package com.java2s; import java.io.IOException; import org.joda.time.DateTime; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; public class Main { public static DateTime nextDateTime(XmlPullParser parser, String tag) throws XmlPullParserException, IOException { parser.require(XmlPullParser.START_TAG, null, tag); DateTime value = DateTime.parse(readText(parser)); parser.require(XmlPullParser.END_TAG, null, tag); return value; }/*from w w w. ja v a 2 s . c o m*/ private static String readText(XmlPullParser parser) throws XmlPullParserException, IOException { String value = null; while (parser.next() != XmlPullParser.END_TAG) { if (parser.getEventType() == XmlPullParser.END_DOCUMENT) { throw new XmlPullParserException( "reached unexpected end of document"); } else if (parser.getEventType() != XmlPullParser.TEXT) { continue; } String text = parser.getText(); value = textOf(text); } return value; } private static String textOf(String text) { return text.trim().replace("\r", ""); } }