Android Open Source - SELP2013 X M L Utilities






From Project

Back to project page SELP2013.

License

The source code is released under:

License ======= This work is licensed under the BSD 2-clause license as follows. # BSD 2-clause license Copyright (c) 2013, Sky Welch All rights reserved. Redistribution and use in source and ...

If you think the Android project SELP2013 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package uk.co.skywelch.selp2013;
/*  www .j  ava  2  s . com*/
import java.io.IOException;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

public class XMLUtilities {
  public static String readString(XmlPullParser parser, String ns, String tag)
      throws IOException, XmlPullParserException {
    parser.require(XmlPullParser.START_TAG, ns, tag);
    String string = readText(parser);
    parser.require(XmlPullParser.END_TAG, ns, tag);
    return string;
  }

  public static int readInteger(XmlPullParser parser, String ns, String tag) throws IOException,
      XmlPullParserException {
    parser.require(XmlPullParser.START_TAG, ns, tag);
    int integer = readInt(parser);
    parser.require(XmlPullParser.END_TAG, ns, tag);
    return integer;
  }

  public static String readText(XmlPullParser parser) throws IOException, XmlPullParserException {
    String result = "";
    if (parser.next() == XmlPullParser.TEXT) {
      result = parser.getText();
      parser.nextTag();
    }
    return result;
  }

  public static int readInt(XmlPullParser parser) throws IOException, XmlPullParserException {
    String result = "";
    if (parser.next() == XmlPullParser.TEXT) {
      result = parser.getText();
      parser.nextTag();
    }
    return Integer.parseInt(result);
  }

  public static void skip(XmlPullParser parser) throws XmlPullParserException, IOException {
    if (parser.getEventType() != XmlPullParser.START_TAG) {
      throw new IllegalStateException();
    }
    int depth = 1;
    while (depth != 0) {
      switch (parser.next()) {
      case XmlPullParser.END_TAG:
        depth--;
        break;
      case XmlPullParser.START_TAG:
        depth++;
        break;
      }
    }
  }
}




Java Source Code List

uk.co.skywelch.selp2013.AboutActivity.java
uk.co.skywelch.selp2013.CourseInformationActivity.java
uk.co.skywelch.selp2013.CourseListActivity.java
uk.co.skywelch.selp2013.CourseListAdapter.java
uk.co.skywelch.selp2013.Course.java
uk.co.skywelch.selp2013.CoursesParseTask.java
uk.co.skywelch.selp2013.CoursesXmlParser.java
uk.co.skywelch.selp2013.DrawerListAdapter.java
uk.co.skywelch.selp2013.FileDownloader.java
uk.co.skywelch.selp2013.HourMinute.java
uk.co.skywelch.selp2013.Lecture.java
uk.co.skywelch.selp2013.ListItem.java
uk.co.skywelch.selp2013.ListSection.java
uk.co.skywelch.selp2013.StringListItem.java
uk.co.skywelch.selp2013.TimetableActivity.java
uk.co.skywelch.selp2013.TimetableFragment.java
uk.co.skywelch.selp2013.TimetableListAdapter.java
uk.co.skywelch.selp2013.TimetableParseTask.java
uk.co.skywelch.selp2013.TimetableXmlParser.java
uk.co.skywelch.selp2013.VenueInformationActivity.java
uk.co.skywelch.selp2013.Venue.java
uk.co.skywelch.selp2013.VenuesParseTask.java
uk.co.skywelch.selp2013.VenuesXmlParser.java
uk.co.skywelch.selp2013.XMLUtilities.java