Android XmlPullParser Read readInteger(XmlPullParser parser, String ns, String tag)

Here you can find the source of readInteger(XmlPullParser parser, String ns, String tag)

Description

read Integer

License

Open Source License

Declaration

public static int readInteger(XmlPullParser parser, String ns,
            String tag) throws IOException, XmlPullParserException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.IOException;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

public class Main {
    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;
    }/*  w  w w. j  av  a2s.c  om*/

    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);
    }
}

Related

  1. readFloatAttribute(XmlPullParser in, String name)
  2. readInt(XmlPullParser parser)
  3. readIntAttribute(XmlPullParser in, String name)
  4. readIntAttribute(XmlPullParser in, String name)
  5. readIntAttribute(XmlPullParser in, String name, int defaultValue)
  6. readLongAttribute(XmlPullParser in, String name)
  7. readLongAttribute(XmlPullParser in, String name, long defaultValue)
  8. readNumber(XmlPullParser parser)
  9. readString(XmlPullParser parser, String ns, String tag)