Code example for XmlPullParser

Methods: nextTag, nextText, require

0
        } 
    } 
 
    private static String getTagContent(XmlPullParser parser, String tag)
            throws XmlPullParserException, IOException { 
        parser.nextTag();
        parser.require(XmlPullParser.START_TAG, null, tag);
        String content = parser.nextText();
        parser.require(XmlPullParser.END_TAG, null, tag);
        return content;
    } 
 
    private static final String TIME = "\\d{1,2}:\\d{2}";
    private static final String TRAIN = "[0-9A-Z]{4,5}";
    private static final String STATION = ".*";
    private static final Pattern TITLE_PATTERN = Pattern.compile("^" + TIME + "  to " + STATION
            + "$"); 
    private static final Pattern TITLE_TERMINUS_PATTERN = Pattern.compile("^Terminates at  "
            + STATION + "$");
    private static final Pattern DESCRIPTION_PATTERN = Pattern.compile("^" + TRAIN
            + " - Origin : (" + STATION + ") - Destination : (" + STATION