当前位置: 首页>>代码示例>>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;未经允许,请勿转载。