当前位置: 首页>>代码示例>>Java>>正文


Java XmlPullParser.END_DOCUMENT属性代码示例

本文整理汇总了Java中org.xmlpull.v1.XmlPullParser.END_DOCUMENT属性的典型用法代码示例。如果您正苦于以下问题:Java XmlPullParser.END_DOCUMENT属性的具体用法?Java XmlPullParser.END_DOCUMENT怎么用?Java XmlPullParser.END_DOCUMENT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.xmlpull.v1.XmlPullParser的用法示例。


在下文中一共展示了XmlPullParser.END_DOCUMENT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readThisListXml

@SuppressWarnings("unchecked")
private static ArrayList readThisListXml(XmlPullParser parser, String endTag, String[] name)
        throws XmlPullParserException, IOException {
    ArrayList list = new ArrayList();

    int eventType = parser.getEventType();
    do {
        if (eventType == XmlPullParser.START_TAG) {
            Object val = readThisValueXml(parser, name);
            list.add(val);
        } else if (eventType == XmlPullParser.END_TAG) {
            if (parser.getName().equals(endTag)) {
                return list;
            }
            throw new XmlPullParserException("Expected " + endTag + " end tag at: " + parser.getName());
        }
        eventType = parser.next();
    } while (eventType != XmlPullParser.END_DOCUMENT);

    throw new XmlPullParserException("Document ended before " + endTag + " end tag");
}
 
开发者ID:Doist,项目名称:JobSchedulerCompat,代码行数:21,代码来源:XmlUtils.java

示例2: parseTbodyXml

private static List<SupportedLanguage> parseTbodyXml(@NonNull XmlPullParser parser) throws Throwable {
    List<SupportedLanguage> tableRows = new LinkedList<>();
    int eventType = parser.getEventType();
    while (eventType != XmlPullParser.END_DOCUMENT) {
        switch (eventType) {
            case XmlPullParser.START_TAG: {
                if ("tr".equalsIgnoreCase(parser.getName())) {
                    List<String> tableRow = parseTableRow(parser);
                    SupportedLanguage convertedEntry = convertElementsToSupportedLanguage(tableRow);
                    tableRows.add(convertedEntry);
                }
                break;
            }
        }
        eventType = parser.next();
    }
    return tableRows;
}
 
开发者ID:powdream,项目名称:google-speech-api-android,代码行数:18,代码来源:SupportedLanguageConverter.java

示例3: parseLayout

/**
 * Parses the layout and returns the number of elements added on the homescreen.
 */
private int parseLayout(int layoutId, ArrayList<Long> screenIds)
        throws XmlPullParserException, IOException {
    XmlResourceParser parser = mSourceRes.getXml(layoutId);
    beginDocument(parser, mRootTag);
    final int depth = parser.getDepth();
    int type;
    HashMap<String, TagParser> tagParserMap = getLayoutElementsMap();
    int count = 0;

    while (((type = parser.next()) != XmlPullParser.END_TAG ||
            parser.getDepth() > depth) && type != XmlPullParser.END_DOCUMENT) {
        if (type != XmlPullParser.START_TAG) {
            continue;
        }
        count += parseAndAddNode(parser, tagParserMap, screenIds);
    }
    return count;
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:21,代码来源:AutoInstallsLayout.java

示例4: parseMerge

private void parseMerge(final XmlPullParser parser, final KeyboardRow row, final boolean skip)
        throws XmlPullParserException, IOException {
    if (DEBUG) startTag("<%s>", TAG_MERGE);
    while (parser.getEventType() != XmlPullParser.END_DOCUMENT) {
        final int event = parser.next();
        if (event == XmlPullParser.START_TAG) {
            final String tag = parser.getName();
            if (TAG_MERGE.equals(tag)) {
                if (row == null) {
                    parseKeyboardContent(parser, skip);
                } else {
                    parseRowContent(parser, row, skip);
                }
                return;
            }
            throw new XmlParseUtils.ParseException(
                    "Included keyboard layout must have <merge> root element", parser);
        }
    }
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:20,代码来源:KeyboardBuilder.java

示例5: parse

Podcasts parse(InputStream input, @Nullable String charset, String baseUri) throws IOException {
    try {
        XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
        factory.setNamespaceAware(true);
        factory.setValidating(false);

        XmlPullParser xpp = factory.newPullParser();
        xpp.setInput(input, charset);

        int eventType = xpp.getEventType();
        while (eventType != XmlPullParser.END_DOCUMENT) {
            if (eventType == XmlPullParser.START_TAG) {
                String tag = xpp.getName();
                if (LayoutUtils.isDiv(tag) && hasClass(xpp, PODCAST_LIST_CLASS)) {
                    return parsePodcasts(xpp, NetworkUtils.toOptURI(baseUri));
                }
            }
            eventType = lenientNext(xpp);
        }
        return new Podcasts();
    } catch (XmlPullParserException e) {
        throw new IOException(e);
    }
}
 
开发者ID:kalikov,项目名称:lighthouse,代码行数:24,代码来源:PodcastsLayoutParser.java

示例6: generateServicesMap

private void generateServicesMap(List<ResolveInfo> services, Map<String, SyncAdapterInfo> map,
                                 RegisteredServicesParser accountParser) {
    for (ResolveInfo info : services) {
        XmlResourceParser parser = accountParser.getParser(mContext, info.serviceInfo, "android.content.SyncAdapter");
        if (parser != null) {
            try {
                AttributeSet attributeSet = Xml.asAttributeSet(parser);
                int type;
                while ((type = parser.next()) != XmlPullParser.END_DOCUMENT && type != XmlPullParser.START_TAG) {
                    // Nothing to do
                }
                if ("sync-adapter".equals(parser.getName())) {
                    SyncAdapterType adapterType = parseSyncAdapterType(
                            accountParser.getResources(mContext, info.serviceInfo.applicationInfo), attributeSet);
                    if (adapterType != null) {
                        String key = adapterType.accountType + "/" + adapterType.authority;
                        map.put(key, new SyncAdapterInfo(adapterType, info.serviceInfo));
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:25,代码来源:VContentService.java

示例7: beginDocument

private static void beginDocument(XmlPullParser parser, String firstElementName)
        throws XmlPullParserException, IOException {

    int type;
    while ((type = parser.next()) != XmlPullParser.START_TAG &&
            type != XmlPullParser.END_DOCUMENT) {
        // Empty
    }

    if (type != XmlPullParser.START_TAG) {
        throw new XmlPullParserException("No start tag found");
    }

    if (!parser.getName().equals(firstElementName)) {
        throw new XmlPullParserException("Unexpected start tag: found " + parser.getName() +
                ", expected " + firstElementName);
    }
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:18,代码来源:Home.java

示例8: skipCurrentTag

public static void skipCurrentTag(XmlPullParser parser)
        throws XmlPullParserException, IOException {
    int outerDepth = parser.getDepth();
    int type;
    while ((type=parser.next()) != XmlPullParser.END_DOCUMENT
           && (type != XmlPullParser.END_TAG
                   || parser.getDepth() > outerDepth)) {
    }
}
 
开发者ID:ukanth,项目名称:XPrivacy,代码行数:9,代码来源:XmlUtils.java

示例9: parseApplicationNameByManifest

/**
 * get application name by manifest
 *
 * @param parser parser
 * @return application name
 */
private static String parseApplicationNameByManifest(XmlPullParser parser) {
    try {
        int eventType = parser.getEventType();
        String namespaceAndroid = null;
        do {
            switch (eventType) {
                case XmlPullParser.START_DOCUMENT: {
                    break;
                }
                case XmlPullParser.START_TAG: {
                    String tag = parser.getName();
                    if (tag.equals("manifest")) {
                        namespaceAndroid = parser.getNamespace("android");
                    } else if ("application".equals(parser.getName())) {
                        String applicationName = parser.getAttributeValue("", "name");
                        if (applicationName == null || "".equals(applicationName)) {
                            applicationName = parser.getAttributeValue(namespaceAndroid, "name");
                        }
                        return applicationName;
                    }
                    break;
                }
                case XmlPullParser.END_TAG: {
                    break;
                }
            }
            eventType = parser.next();
        } while (eventType != XmlPullParser.END_DOCUMENT);
    } catch (Exception e1) {
    }
    return "";
}
 
开发者ID:LiangMaYong,项目名称:android-apkbox,代码行数:38,代码来源:ApkManifestParser.java

示例10: getPredefinedDeviceProfiles

ArrayList<InvariantDeviceProfile> getPredefinedDeviceProfiles(Context context) {
    ArrayList<InvariantDeviceProfile> profiles = new ArrayList<>();
    try (XmlResourceParser parser = context.getResources().getXml(R.xml.device_profiles)) {
        final int depth = parser.getDepth();
        int type;

        while (((type = parser.next()) != XmlPullParser.END_TAG ||
                parser.getDepth() > depth) && type != XmlPullParser.END_DOCUMENT) {
            if ((type == XmlPullParser.START_TAG) && "profile".equals(parser.getName())) {
                TypedArray a = context.obtainStyledAttributes(
                        Xml.asAttributeSet(parser), R.styleable.InvariantDeviceProfile);
                int numRows = a.getInt(R.styleable.InvariantDeviceProfile_numRows, 0);
                int numColumns = a.getInt(R.styleable.InvariantDeviceProfile_numColumns, 0);
                float iconSize = a.getFloat(R.styleable.InvariantDeviceProfile_iconSize, 0);
                profiles.add(new InvariantDeviceProfile(
                        a.getString(R.styleable.InvariantDeviceProfile_name),
                        a.getFloat(R.styleable.InvariantDeviceProfile_minWidthDps, 0),
                        a.getFloat(R.styleable.InvariantDeviceProfile_minHeightDps, 0),
                        numRows,
                        numColumns,
                        a.getInt(R.styleable.InvariantDeviceProfile_numFolderRows, numRows),
                        a.getInt(R.styleable.InvariantDeviceProfile_numFolderColumns, numColumns),
                        a.getInt(R.styleable.InvariantDeviceProfile_minAllAppsPredictionColumns, numColumns),
                        iconSize,
                        a.getFloat(R.styleable.InvariantDeviceProfile_iconTextSize, 0),
                        a.getInt(R.styleable.InvariantDeviceProfile_numHotseatIcons, numColumns),
                        a.getFloat(R.styleable.InvariantDeviceProfile_hotseatIconSize, iconSize),
                        a.getResourceId(R.styleable.InvariantDeviceProfile_defaultLayoutId, 0)));
                a.recycle();
            }
        }
    } catch (IOException|XmlPullParserException e) {
        throw new RuntimeException(e);
    }
    return profiles;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:36,代码来源:InvariantDeviceProfile.java

示例11: nextElementWithin

public static boolean nextElementWithin(XmlPullParser parser, int outerDepth)
        throws IOException, XmlPullParserException {
    for (;;) {
        int type = parser.next();
        if (type == XmlPullParser.END_DOCUMENT
                || (type == XmlPullParser.END_TAG && parser.getDepth() == outerDepth)) {
            return false;
        }
        if (type == XmlPullParser.START_TAG
                && parser.getDepth() == outerDepth + 1) {
            return true;
        }
    }
}
 
开发者ID:ukanth,项目名称:XPrivacy,代码行数:14,代码来源:XmlUtils.java

示例12: parserSimples

public static List<String> parserSimples(String rssFeed) throws XmlPullParserException, IOException {
    // pegando instancia da XmlPullParserFactory [singleton]
    XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
    // criando novo objeto do tipo XmlPullParser
    XmlPullParser parser = factory.newPullParser();
    // Definindo a entrada do nosso parser - argumento passado como parametro
    parser.setInput(new StringReader(rssFeed));
    // Definindo retorno
    List<String> items = new ArrayList<String>();

    while (parser.next() != XmlPullParser.END_DOCUMENT) {
        if (parser.getEventType() == XmlPullParser.START_TAG) {
            String tag = parser.getName();
            //delimitando que estamos apenas interessados em tags <item>
            if (tag.equals("item")) {
                String title = "";
                while (parser.next() != XmlPullParser.END_TAG) {
                    if (parser.getEventType() == XmlPullParser.START_TAG) {
                        String tagAberta = parser.getName();
                        //pegando as tags <title>
                        if (tagAberta.equals("title")) {
                            title = parser.nextText();
                            items.add(title);
                        } else {
                            parser.next();
                        }
                        parser.nextTag();
                    }
                }
            }
        }
    }
    return items;
}
 
开发者ID:if1001,项目名称:tarefa01-blaandrade,代码行数:34,代码来源:ParserRSS.java

示例13: parseImpl

public static ProcedureInfo parseImpl(XmlPullParser parser)
        throws BlockLoadingException, IOException, XmlPullParserException {
    List<String> argNames = new ArrayList<>();
    String procedureName = null;
    boolean hasStatementInput = HAS_STATEMENTS_DEFAULT;

    int tokenType = parser.next();
    if (tokenType != XmlPullParser.END_DOCUMENT) {
        parser.require(XmlPullParser.START_TAG, null, Mutator.TAG_MUTATION);

        String attrValue = parser.getAttributeValue(null, ATTR_NAME);
        if (!TextUtils.isEmpty(attrValue)) {
            procedureName = attrValue;
        }

        attrValue = parser.getAttributeValue(null, ATTR_STATEMENTS);
        if (!TextUtils.isEmpty(attrValue)) {
            hasStatementInput = Boolean.getBoolean(attrValue);
        }

        tokenType = parser.next();
        while (tokenType != XmlPullParser.END_DOCUMENT) {
            if (tokenType == XmlPullParser.START_TAG) {
                parser.require(XmlPullParser.START_TAG, null, TAG_ARG);
                String argName = parser.getAttributeValue(null, ATTR_ARG_NAME);
                if (argName == null) {
                    throw new BlockLoadingException(
                            "Function argument #" + argNames.size() + " missing name.");
                }
                argNames.add(argName);
            } else if (tokenType == XmlPullParser.END_TAG
                    && parser.getName().equals(Mutator.TAG_MUTATION)) {
                break;
            }
            tokenType = parser.next();
        }
    }

    return new ProcedureInfo(procedureName, argNames, hasStatementInput);
}
 
开发者ID:Axe-Ishmael,项目名称:Blockly,代码行数:40,代码来源:ProcedureInfo.java

示例14: loadAllDrawables

private void loadAllDrawables(String packageName) {
    mDrawables.clear();
    XmlPullParser xpp;
    try {
        Resources res = mPackageManager.getResourcesForApplication(packageName);
        mCurrentIconPackRes = res;
        int resource = res.getIdentifier("drawable", "xml", packageName);
        if (resource < 0) {
            return;
        }
        xpp = res.getXml(resource);
        int eventType = xpp.getEventType();
        while (eventType != XmlPullParser.END_DOCUMENT) {
            if (eventType == XmlPullParser.START_TAG) {
                if (xpp.getName().equals("item")) {
                    String drawableName = xpp.getAttributeValue(null, "drawable");
                    if (!mDrawables.contains(drawableName) &&
                            getIdentifier(packageName, drawableName, true) > 0) {
                        mDrawables.add(drawableName);
                    }
                }
            }
            eventType = xpp.next();
        }
    } catch (Exception e) {
        e.printStackTrace();
        // fallback onto appfilter if drawable xml fails
        loadIconPack(packageName, true, mContext);
    }
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:30,代码来源:IconsManager.java

示例15: retrieveSupportedDevices

private static void retrieveSupportedDevices(final Resources resources) {
    final String tag = "retrieveDeviceData - ";

    if (supportedDevices == null) {
        final List<SupportedDevice> result = new ArrayList<>();
        final XmlResourceParser xml = resources.getXml(R.xml.supported_devices);
        try {
            xml.next();
            int eventType;
            while ((eventType = xml.getEventType()) != XmlPullParser.END_DOCUMENT) {
                switch (eventType) {
                    case XmlPullParser.START_TAG:
                        if (xml.getName().equals("usb-device")) {
                            final AttributeSet as = Xml.asAttributeSet(xml);
                            final Integer vendorId = parseInt(as.getAttributeValue(null, "vendor-id"));
                            final Integer productId = parseInt(as.getAttributeValue(null, "product-id"));

                            // Read description
                            String description=null;
                            xml.next();
                            if (xml.getName().equals("description")) {
                                xml.require(XmlPullParser.START_TAG, null, "description");
                                if (xml.next() == XmlPullParser.TEXT) {
                                    description = xml.getText();
                                    xml.nextTag();
                                }

                                xml.require(XmlPullParser.END_TAG, null, "description");
                            }
                            result.add(new SupportedDevice(new Pair<>(vendorId, productId), description));
                        }
                        break;
                }
                xml.next();
            }
        } catch (XmlPullParserException | IOException e) {
            Log.e(TAG, tag, e);
        }

        supportedDevices = result;
    }
}
 
开发者ID:videgro,项目名称:Ships,代码行数:42,代码来源:UsbUtils.java


注:本文中的org.xmlpull.v1.XmlPullParser.END_DOCUMENT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。