當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。