當前位置: 首頁>>代碼示例>>Java>>正文


Java XmlPullParser.next方法代碼示例

本文整理匯總了Java中org.xmlpull.v1.XmlPullParser.next方法的典型用法代碼示例。如果您正苦於以下問題:Java XmlPullParser.next方法的具體用法?Java XmlPullParser.next怎麽用?Java XmlPullParser.next使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.xmlpull.v1.XmlPullParser的用法示例。


在下文中一共展示了XmlPullParser.next方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: readPropStat

import org.xmlpull.v1.XmlPullParser; //導入方法依賴的package包/類
private Response.PropStat readPropStat(XmlPullParser parser) throws IOException, XmlPullParserException {
    Response.PropStat propstat = new Response.PropStat();
    parser.require(XmlPullParser.START_TAG, ns, "propstat");
    android.util.Log.d("PARSE", "readPropStat");
    while (parser.next() != XmlPullParser.END_TAG) {

        android.util.Log.d("PARSE", "3eventtype=" + parser.getEventType());

        if (parser.getEventType() != XmlPullParser.START_TAG) {
            continue;
        }
        String name = parser.getName();
        android.util.Log.d("PARSE", "3name=" + name);
        if (name.equals("prop"))
        {
            propstat.prop = readProp(parser);
        } else if (name.equals("status"))
        {
            propstat.status = readText(parser);
        } else {
            skip(parser);
        }
    }
    return propstat;
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:26,代碼來源:PropfindXmlParser.java

示例2: parseTvListings

import org.xmlpull.v1.XmlPullParser; //導入方法依賴的package包/類
private static TvListing parseTvListings(XmlPullParser parser)
        throws IOException, XmlPullParserException, ParseException {
    List<XmlTvChannel> channels = new ArrayList<>();
    List<XmlTvProgram> programs = new ArrayList<>();
    while (parser.next() != XmlPullParser.END_DOCUMENT) {
        if (parser.getEventType() == XmlPullParser.START_TAG
                && TAG_CHANNEL.equalsIgnoreCase(parser.getName())) {
            channels.add(parseChannel(parser));
        }
        if (parser.getEventType() == XmlPullParser.START_TAG
                && TAG_PROGRAM.equalsIgnoreCase(parser.getName())) {
            programs.add(parseProgram(parser));
        }
    }
    return new TvListing(channels, programs);
}
 
開發者ID:nejtv,項目名稱:androidtv-sample,代碼行數:17,代碼來源:XmlTvParser.java

示例3: readThisArrayMapXml

import org.xmlpull.v1.XmlPullParser; //導入方法依賴的package包/類
/**
 * Like {@link #readThisMapXml}, but returns an ArrayMap instead of HashMap.
 * @hide
 */
public static final ArrayMap<String, ?> readThisArrayMapXml(XmlPullParser parser, String endTag,
        String[] name, ReadMapCallback callback)
        throws XmlPullParserException, java.io.IOException
{
    ArrayMap<String, Object> map = new ArrayMap<>();

    int eventType = parser.getEventType();
    do {
        if (eventType == parser.START_TAG) {
            Object val = readThisValueXml(parser, name, callback, true);
            map.put(name[0], val);
        } else if (eventType == parser.END_TAG) {
            if (parser.getName().equals(endTag)) {
                return map;
            }
            throw new XmlPullParserException(
                "Expected " + endTag + " end tag at: " + parser.getName());
        }
        eventType = parser.next();
    } while (eventType != parser.END_DOCUMENT);

    throw new XmlPullParserException(
        "Document ended before " + endTag + " end tag");
}
 
開發者ID:ukanth,項目名稱:XPrivacy,代碼行數:29,代碼來源:XmlUtils.java

示例4: skip

import org.xmlpull.v1.XmlPullParser; //導入方法依賴的package包/類
private void skip(XmlPullParser parser) throws XmlPullParserException, IOException {
    android.util.Log.d("PARSE", "skipping " + parser.getName());

    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;
        }
    }
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:19,代碼來源:PropfindXmlParser.java

示例5: readFeatures

import org.xmlpull.v1.XmlPullParser; //導入方法依賴的package包/類
private List<Features> readFeatures(XmlPullParser parser) throws XmlPullParserException {
    final List<Features> result = new ArrayList<>();
    try {
        parser.require(XmlPullParser.START_TAG, null, FEATURES);
        while(parser.next() != XmlPullParser.END_TAG){
            if(parser.getEventType() != XmlPullParser.START_TAG){
                continue;
            }

            String name = parser.getName();
            if (name.equals(FEATURES)) {
                result.add(Features.valueOf(readText(parser)));
            }
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    return result;
}
 
開發者ID:ABTSoftware,項目名稱:SciChart.Android.Examples,代碼行數:20,代碼來源:ExampleDefinitionParser.java

示例6: skip

import org.xmlpull.v1.XmlPullParser; //導入方法依賴的package包/類
private 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;
        }
    }
}
 
開發者ID:5GSD,項目名稱:AIMSICDL,代碼行數:17,代碼來源:StackOverflowXmlParser.java

示例7: parseIcon

import org.xmlpull.v1.XmlPullParser; //導入方法依賴的package包/類
private static XmlTvIcon parseIcon(XmlPullParser parser)
        throws IOException, XmlPullParserException {
    String src = null;
    for (int i = 0; i < parser.getAttributeCount(); ++i) {
        String attr = parser.getAttributeName(i);
        String value = parser.getAttributeValue(i);
        if (ATTR_SRC.equalsIgnoreCase(attr)) {
            src = value;
        }
    }
    while (parser.next() != XmlPullParser.END_DOCUMENT) {
        if (TAG_ICON.equalsIgnoreCase(parser.getName())
                && parser.getEventType() == XmlPullParser.END_TAG) {
            break;
        }
    }
    if (TextUtils.isEmpty(src)) {
        throw new IllegalArgumentException("src cannot be null.");
    }
    return new XmlTvIcon(src);
}
 
開發者ID:nejtv,項目名稱:androidtv-sample,代碼行數:22,代碼來源:XmlTvParser.java

示例8: parseKeyboard

import org.xmlpull.v1.XmlPullParser; //導入方法依賴的package包/類
private void parseKeyboard(final XmlPullParser parser)
        throws XmlPullParserException, IOException {
    if (DEBUG) startTag("<%s> %s", TAG_KEYBOARD, mParams.mId);
    while (parser.getEventType() != XmlPullParser.END_DOCUMENT) {
        final int event = parser.next();
        if (event == XmlPullParser.START_TAG) {
            final String tag = parser.getName();
            if (TAG_KEYBOARD.equals(tag)) {
                parseKeyboardAttributes(parser);
                startKeyboard();
                parseKeyboardContent(parser, false);
                return;
            }
            throw new XmlParseUtils.IllegalStartTag(parser, tag, TAG_KEYBOARD);
        }
    }
}
 
開發者ID:rkkr,項目名稱:simple-keyboard,代碼行數:18,代碼來源:KeyboardBuilder.java

示例9: updateImportFile

import org.xmlpull.v1.XmlPullParser; //導入方法依賴的package包/類
/**
 * Updates the passed import file into the equivalent 1.4 format.
 * 
 * @param source		the source import file
 * @param destination	the destination import file
 */
public void updateImportFile(String source, String destination)
{
	XmlPullParser reader = getReader(source);
	XMLWriter writer = getWriter(destination);
	this.shownWarning = false;
	
	try
	{
		// Start the documentation
		writer.startDocument();
		
		// Start reading the document
		int eventType = reader.getEventType();
		while (eventType != XmlPullParser.END_DOCUMENT) 
        {
            if (eventType == XmlPullParser.START_TAG) 
			{
            	ImportFileUpdater.this.outputCurrentElement(reader, writer, new OutputChildren());
			} 
			eventType = reader.next();
        }
		
		// End and close the document
		writer.endDocument();
		writer.close();
	}
	catch (Exception exception)
	{
		throw new AlfrescoRuntimeException("Unable to update import file.", exception);
	}
	
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:39,代碼來源:ImportFileUpdater.java

示例10: getRootFilesFromContainer

import org.xmlpull.v1.XmlPullParser; //導入方法依賴的package包/類
private static List<String> getRootFilesFromContainer(BufferedReader containerxml) {

        List<String> rootFiles = new ArrayList<>();

        try {

            containerxml.mark(4);
            if ('\ufeff' != containerxml.read()) containerxml.reset(); // not the BOM marker

            XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
            factory.setNamespaceAware(false);
            XmlPullParser xpp = factory.newPullParser();
            xpp.setInput(containerxml);

            int eventType = xpp.getEventType();
            while (eventType != XmlPullParser.END_DOCUMENT) {
                if (eventType == XmlPullParser.START_TAG) {
                    if (xpp.getName().equals("rootfile")) {
                        for (int i = 0; i < xpp.getAttributeCount(); i++) {
                            if (xpp.getAttributeName(i).equals("full-path")) {
                                rootFiles.add(xpp.getAttributeValue(i));
                            }
                        }
                    }

                }
                eventType = xpp.next();
            }
        } catch (Exception e) {
            Log.e("BMBF", "Error parsing xml " + e, e);
        }

        return rootFiles;

    }
 
開發者ID:quaap,項目名稱:BookyMcBookface,代碼行數:36,代碼來源:EpubBook.java

示例11: readExampleDefinition

import org.xmlpull.v1.XmlPullParser; //導入方法依賴的package包/類
private ExampleDefinition readExampleDefinition(XmlPullParser parser) throws IOException, XmlPullParserException {
    parser.require(XmlPullParser.START_TAG, null, EXAMPLE_DEFINITION);
    String title = "";
    String iconPath = "";
    String description = "";
    final List<String> codeFiles = new ArrayList<>();
    final List<Features> features = new ArrayList<>();
    boolean isVisible = false;
    while (parser.next() != XmlPullParser.END_TAG) {
        if (parser.getEventType() != XmlPullParser.START_TAG) {
            continue;
        }
        final String name = parser.getName();
        switch (name) {
            case TITLE:
                title = readElement(parser, TITLE);
                break;
            case ICON_PATH:
                iconPath = readElement(parser, ICON_PATH);
                break;
            case DESCRIPTION:
                description = parseDescription(readElement(parser, DESCRIPTION));
                break;
            case CODE_FILES:
                codeFiles.addAll(readCodeFiles(parser));
                break;
            case FEATURES:
                features.addAll(readFeatures(parser));
                break;
            case IS_VISIBLE:
                isVisible = Boolean.parseBoolean(readElement(parser, IS_VISIBLE));
                break;
            default:
                skip(parser);
                break;
        }
    }
    return new ExampleDefinition(title, "", "", iconPath, description, codeFiles, features, isVisible);
}
 
開發者ID:ABTSoftware,項目名稱:SciChart.Android.Examples,代碼行數:40,代碼來源:ExampleDefinitionParser.java

示例12: readTrkSeg

import org.xmlpull.v1.XmlPullParser; //導入方法依賴的package包/類
private void readTrkSeg(XmlPullParser parser) throws XmlPullParserException, IOException, ParseException {
    parser.require(XmlPullParser.START_TAG, ns, "trkseg");
    while (parser.next() != XmlPullParser.END_TAG) {
        if (parser.getEventType() != XmlPullParser.START_TAG) {
            continue;
        }
        String name = parser.getName();
        // Starts by looking for the entry tag
        if (name.equals("trkpt")) {
            readTrkPt(parser);
        } else {
            skip(parser);
        }
    }
}
 
開發者ID:gimportexportdevs,項目名稱:gexporter,代碼行數:16,代碼來源:Gpx2Fit.java

示例13: readText

import org.xmlpull.v1.XmlPullParser; //導入方法依賴的package包/類
private String readText(XmlPullParser parser) throws IOException, XmlPullParserException {
    String result = "";
    if (parser.next() == XmlPullParser.TEXT) {
        result = parser.getText();
        parser.nextTag();
    }
    return result;
}
 
開發者ID:ABTSoftware,項目名稱:SciChart.Android.Examples,代碼行數:9,代碼來源:ExampleDefinitionParser.java

示例14: create

import org.xmlpull.v1.XmlPullParser; //導入方法依賴的package包/類
@Nullable
public static VectorDrawableCompat create(@NonNull Resources res, @DrawableRes int resId, @Nullable Theme theme) {
    if (VERSION.SDK_INT >= 21) {
        VectorDrawableCompat drawable = new VectorDrawableCompat();
        drawable.mDelegateDrawable = ResourcesCompat.getDrawable(res, resId, theme);
        drawable.mCachedConstantStateDelegate = new VectorDrawableDelegateState(drawable.mDelegateDrawable.getConstantState());
        return drawable;
    }
    try {
        int type;
        XmlPullParser parser = res.getXml(resId);
        AttributeSet attrs = Xml.asAttributeSet(parser);
        do {
            type = parser.next();
            if (type == 2) {
                break;
            }
        } while (type != 1);
        if (type == 2) {
            return createFromXmlInner(res, parser, attrs, theme);
        }
        throw new XmlPullParserException("No start tag found");
    } catch (XmlPullParserException e) {
        Log.e(LOGTAG, "parser error", e);
        return null;
    } catch (IOException e2) {
        Log.e(LOGTAG, "parser error", e2);
        return null;
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:31,代碼來源:VectorDrawableCompat.java

示例15: readText

import org.xmlpull.v1.XmlPullParser; //導入方法依賴的package包/類
private String readText(@NonNull XmlPullParser parser) throws IOException, XmlPullParserException {
    String result = "";

    if (parser.next() == XmlPullParser.TEXT) {
        result = parser.getText();
        parser.nextTag();
    }

    return result;
}
 
開發者ID:GuepardoApps,項目名稱:LucaHome-AndroidApplication,代碼行數:11,代碼來源:RssParser.java


注:本文中的org.xmlpull.v1.XmlPullParser.next方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。