Android XmlPullParser Create getXmlPullParser(String xml)

Here you can find the source of getXmlPullParser(String xml)

Description

Get a default XmlPullParser

Declaration

public static XmlPullParser getXmlPullParser(String xml)
        throws XmlPullParserException, IOException 

Method Source Code

//package com.java2s;

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

public class Main {
    /**// ww w  . j  a v  a2 s  . c o m
     * Get a default XmlPullParser
     */
    public static XmlPullParser getXmlPullParser(String xml)
            throws XmlPullParserException, IOException {
        XmlPullParserFactory xppFactory = XmlPullParserFactory
                .newInstance();
        xppFactory.setNamespaceAware(false);
        XmlPullParser parser = xppFactory.newPullParser();
        parser.setInput(new StringReader(xml));
        parser.nextTag();
        return parser;
    }
}

Related

  1. makeInstanceFromUrl(Context context, URL url)
  2. makeInstanceFromUrl(Context context, URL url, String filename)
  3. getPullParserFromAssert(Context context, String fileName, String encoding)
  4. getPullParserFromClass( ClassLoader classLoader, String fileName, String encoding)