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


Java XmlPullParser.END_TAG属性代码示例

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


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

示例1: inflateChildren

private void inflateChildren(XmlPullParser parser, Node node) throws IOException, XmlPullParserException {
   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){
           continue;
       }
       String tagName=parser.getName();
       //创建当前标签Node
       Node view=createNodeFromTag(tagName);
       if(view!=null&&node instanceof ViewGroup){
           ViewGroup viewGroup= (ViewGroup) node;
           //查找当前标签其内是否还有其他标签如果没有就直接返回
           inflateChildren(parser,view);
           viewGroup.addNode(view);
       }
   }
}
 
开发者ID:whitewoodcity,项目名称:xbrowser,代码行数:19,代码来源:LayoutInflater.java

示例2: skip

private static 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;
            default:
                // Do nothing - we're skipping content
        }
    }
}
 
开发者ID:mozilla-mobile,项目名称:firefox-tv,代码行数:18,代码来源:SearchEngineParser.java

示例3: readCodeFiles

private List<String> readCodeFiles(XmlPullParser parser) throws XmlPullParserException {
    final List<String> result = new ArrayList<>();
    try {
        parser.require(XmlPullParser.START_TAG, null, CODE_FILES);
        while(parser.next() != XmlPullParser.END_TAG){
            if(parser.getEventType() != XmlPullParser.START_TAG) {
                continue;
            }

            final String name = parser.getName();
            if (name.equals("string")) {
                result.add(readText(parser));
            }
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    return result;
}
 
开发者ID:ABTSoftware,项目名称:SciChart.Android.Examples,代码行数:19,代码来源:ExampleDefinitionParser.java

示例4: skipXmlTagParse

private void skipXmlTagParse(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:malah-code,项目名称:Open-Quran-Radio,代码行数:16,代码来源:Station.java

示例5: parseAndAdd

@Override
public long parseAndAdd(XmlResourceParser parser)
        throws XmlPullParserException, IOException {
    final String packageName = getAttributeValue(parser, ATTR_PACKAGE_NAME);
    final String className = getAttributeValue(parser, ATTR_CLASS_NAME);
    if (TextUtils.isEmpty(packageName) || TextUtils.isEmpty(className)) {
        if (LOGD) Log.d(TAG, "Skipping invalid <appwidget> with no component");
        return -1;
    }

    mValues.put(Favorites.SPANX, getAttributeValue(parser, ATTR_SPAN_X));
    mValues.put(Favorites.SPANY, getAttributeValue(parser, ATTR_SPAN_Y));
    mValues.put(Favorites.ITEM_TYPE, Favorites.ITEM_TYPE_APPWIDGET);

    // Read the extras
    Bundle extras = new Bundle();
    int widgetDepth = parser.getDepth();
    int type;
    while ((type = parser.next()) != XmlPullParser.END_TAG ||
            parser.getDepth() > widgetDepth) {
        if (type != XmlPullParser.START_TAG) {
            continue;
        }

        if (TAG_EXTRA.equals(parser.getName())) {
            String key = getAttributeValue(parser, ATTR_KEY);
            String value = getAttributeValue(parser, ATTR_VALUE);
            if (key != null && value != null) {
                extras.putString(key, value);
            } else {
                throw new RuntimeException("Widget extras must have a key and value");
            }
        } else {
            throw new RuntimeException("Widgets can contain only extras");
        }
    }

    return verifyAndInsert(new ComponentName(packageName, className), extras);
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:39,代码来源:AutoInstallsLayout.java

示例6: skip

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:sdrausty,项目名称:buildAPKsSamples,代码行数:16,代码来源:StackOverflowXmlParser.java

示例7: skip

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:DroidThug,项目名称:VulcanOTA,代码行数:16,代码来源:OTAParser.java

示例8: readExampleDefinition

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,代码行数:39,代码来源:ExampleDefinitionParser.java

示例9: readResponse

private Response readResponse(XmlPullParser parser) throws IOException, XmlPullParserException {
    Response response = new Response();

    parser.require(XmlPullParser.START_TAG, ns, "response");

    android.util.Log.d("PARSE", "readResponse");

    while (parser.next() != XmlPullParser.END_TAG) {
        android.util.Log.d("PARSE", "2eventtype=" + parser.getEventType());

        if (parser.getEventType() != XmlPullParser.START_TAG) {
            continue;
        }
        String name = parser.getName();


        android.util.Log.d("PARSE", "2name=" + name);


        if (name.equals("href")) {
            response.href = readText(parser);
        } else if (name.equals("propstat")) {
            response.propstat.add(readPropStat(parser));
        } else {
            skip(parser);
        }
    }
    return response;

}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:30,代码来源:PropfindXmlParser.java

示例10: readTrkSeg

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,代码行数:15,代码来源:Gpx2Fit.java

示例11: readNameSet

private void readNameSet(@NonNull XmlPullParser parser, @NonNull FontFamily fontFamily)
        throws XmlPullParserException, IOException {
    while (parser.next() != XmlPullParser.END_TAG) {
        if (parser.getEventType() == XmlPullParser.START_TAG && parser.getName().equals("name")) {
            if (fontFamily.name == null)
                fontFamily.name = readText(parser);
            else {
                // skip all other names
                parser.next();
                parser.next();
            }
        }
    }
}
 
开发者ID:olgamiller,项目名称:SSTVEncoder2,代码行数:14,代码来源:FontFamilySet.java

示例12: 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:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:36,代码来源:InvariantDeviceProfile.java

示例13: inflateColorStateList

static ColorStateList inflateColorStateList(Context context, XmlPullParser parser, AttributeSet attrs) throws IOException, XmlPullParserException {
    final int innerDepth = parser.getDepth() + 1;
    int depth;
    int type;

    LinkedList<int[]> stateList = new LinkedList<>();
    LinkedList<Integer> colorList = new LinkedList<>();

    while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
            && ((depth = parser.getDepth()) >= innerDepth || type != XmlPullParser.END_TAG)) {
        if (type != XmlPullParser.START_TAG || depth > innerDepth
                || !parser.getName().equals("item")) {
            continue;
        }

        TypedArray a1 = context.obtainStyledAttributes(attrs, new int[]{android.R.attr.color});
        final int value = a1.getResourceId(0, Color.MAGENTA);
        final int baseColor = value == Color.MAGENTA ? Color.MAGENTA : ThemeUtils.replaceColorById(context, value);
        a1.recycle();
        TypedArray a2 = context.obtainStyledAttributes(attrs, new int[]{android.R.attr.alpha});
        final float alphaMod = a2.getFloat(0, 1.0f);
        a2.recycle();
        colorList.add(alphaMod != 1.0f
                ? ColorUtils.setAlphaComponent(baseColor, Math.round(Color.alpha(baseColor) * alphaMod))
                : baseColor);

        stateList.add(extractStateSet(attrs));
    }

    if (stateList.size() > 0 && stateList.size() == colorList.size()) {
        int[] colors = new int[colorList.size()];
        for (int i = 0; i < colorList.size(); i++) {
            colors[i] = colorList.get(i);
        }
        return new ColorStateList(stateList.toArray(new int[stateList.size()][]), colors);
    }
    return null;
}
 
开发者ID:Pingsh,项目名称:Mix,代码行数:38,代码来源:ColorStateListUtils.java

示例14: parseRecords

private static Records parseRecords(XmlPullParser xpp, @Nullable URI uri) throws IOException, XmlPullParserException {
    Records records = new Records();

    LayoutUtils.Stack path = new LayoutUtils.Stack(3);
    push(path, xpp);

    int eventType = lenientNext(xpp);
    while (eventType != XmlPullParser.END_DOCUMENT) {
        if (eventType == XmlPullParser.START_TAG) {
            String tag = xpp.getName();
            if (LayoutUtils.isDiv(tag) && hasClass(xpp, RECORD_ITEM_CLASS)) {
                Record record = parseRecord(xpp, uri);
                if (record != null) {
                    records.add(record);
                }
            } else {
                push(path, xpp);
            }
        } else if (eventType == XmlPullParser.END_TAG) {
            pop(path, xpp);
            if (path.isEmpty()) {
                break;
            }
        }
        eventType = lenientNext(xpp);
    }
    return records;
}
 
开发者ID:kalikov,项目名称:lighthouse,代码行数:28,代码来源:PodcastLayoutParser.java

示例15: createAnimationFromXml

private static Animation createAnimationFromXml(Context c, XmlPullParser parser,
                                                AnimationSet parent, AttributeSet attrs) throws XmlPullParserException, IOException {

    Animation anim = null;

    // Make sure we are on a start tag.
    int type;
    int depth = parser.getDepth();

    while (((type=parser.next()) != XmlPullParser.END_TAG || parser.getDepth() > depth)
            && type != XmlPullParser.END_DOCUMENT) {

        if (type != XmlPullParser.START_TAG) {
            continue;
        }

        String  name = parser.getName();

        if (name.equals("set")) {
            anim = new AnimationSet(c, attrs);
            createAnimationFromXml(c, parser, (AnimationSet)anim, attrs);
        } else if (name.equals("alpha")) {
            anim = new AlphaAnimation(c, attrs);
        } else if (name.equals("scale")) {
            anim = new ScaleAnimation(c, attrs);
        }  else if (name.equals("rotate")) {
            anim = new RotateAnimation(c, attrs);
        }  else if (name.equals("translate")) {
            anim = new TranslateAnimation(c, attrs);
        } else {
            try {
                anim = (Animation) Class.forName(name).getConstructor(Context.class, AttributeSet.class).newInstance(c, attrs);
            } catch (Exception te) {
                throw new RuntimeException("Unknown animation name: " + parser.getName() + " error:" + te.getMessage());
            }
        }

        if (parent != null) {
            parent.addAnimation(anim);
        }
    }

    return anim;

}
 
开发者ID:weimin96,项目名称:shareNote,代码行数:45,代码来源:OptAnimationLoader.java


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