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

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

Description

read String

License

Open Source License

Declaration

public static String readString(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 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;
    }/*from w  w w  . ja va  2  s. c o m*/

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

Related

  1. readIntAttribute(XmlPullParser in, String name, int defaultValue)
  2. readInteger(XmlPullParser parser, String ns, String tag)
  3. readLongAttribute(XmlPullParser in, String name)
  4. readLongAttribute(XmlPullParser in, String name, long defaultValue)
  5. readNumber(XmlPullParser parser)
  6. readStringArray(XmlPullParser parser, String tagName, String delimiter)
  7. readStringAttribute(XmlPullParser in, String name)
  8. readText(XmlPullParser parser)
  9. readText(XmlPullParser parser)