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


Java XmlPullParser.START_TAG屬性代碼示例

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


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

示例1: generateServicesMap

private void generateServicesMap(List<ResolveInfo> services, Map<String, AuthenticatorInfo> map,
								 IAccountParser accountParser) {
	for (ResolveInfo info : services) {
		XmlResourceParser parser = accountParser.getParser(mContext, info.serviceInfo,
				AccountManager.AUTHENTICATOR_META_DATA_NAME);
		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 (AccountManager.AUTHENTICATOR_ATTRIBUTES_NAME.equals(parser.getName())) {
					AuthenticatorDescription desc = parseAuthenticatorDescription(
							accountParser.getResources(mContext, info.serviceInfo.applicationInfo),
							info.serviceInfo.packageName, attributeSet);
					if (desc != null) {
						map.put(desc.type, new AuthenticatorInfo(desc, info.serviceInfo));
					}
				}
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:26,代碼來源:VAccountManagerService.java

示例2: 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:gimportexportdevs,項目名稱:gexporter,代碼行數:16,代碼來源:Gpx2Fit.java

示例3: parseLayout

/**
 * Parses the layout and returns the number of elements added on the homescreen.
 */
protected 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:michelelacorte,項目名稱:FlickLauncher,代碼行數:21,代碼來源:AutoInstallsLayout.java

示例4: parseTextContentToString

/**
 * Parse the text content of an element.
 * Precondition: behind the opening tag
 * Postcondition: on the closing tag
 */
private void parseTextContentToString(StringBuilder sb) throws IOException, XmlPullParserException {
  while (input.getEventType() != XmlPullParser.END_TAG) {
    switch(input.getEventType()) {
      case XmlPullParser.START_TAG:
        input.next();
        parseTextContentToString(sb);
        input.next();
        break;

      case XmlPullParser.TEXT:
        if (sb != null) {
          sb.append(input.getText());
        }
        input.next();
        break;

      default:
        throw new RuntimeException("Unexpected event: " + input.getPositionDescription());
    }
  }
}
 
開發者ID:stefanhaustein,項目名稱:nativehtml,代碼行數:26,代碼來源:HtmlParser.java

示例5: skip

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,代碼行數:18,代碼來源:PropfindXmlParser.java

示例6: 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

示例7: readThemeSetting

/***
 * Public method that read information about theme settings from XML file
 * @param parser                    the current parser used to parse the XML file
 * @return ThemeSetting contains loaded settings
 * @throws XmlPullParserException
 * @throws IOException
 */
private ThemeSetting readThemeSetting(XmlPullParser parser) throws XmlPullParserException, IOException {
    parser.require(XmlPullParser.START_TAG, null, "themesetting");

    ArrayMap<String, String> newValues = new ArrayMap<>();
    while (parser.next() != XmlPullParser.END_TAG) {
        if (parser.getEventType() != XmlPullParser.START_TAG) {
            continue;
        }
        String name = parser.getName();
        if (name.equals("font")) {
            newValues.put("font", readText(parser));
        } else if (name.equals("palette")) {
            newValues.put("palette", readText(parser));
        } else if (name.equals("highlight")) {
            newValues.put("highlight", readText(parser));
        }
    }

    ThemeSetting themesetting = new ThemeSetting();
    themesetting.changeSetting(newValues);
    return themesetting;
}
 
開發者ID:Visions-Team,項目名稱:eBread,代碼行數:29,代碼來源:SettingManager.java

示例8: 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

示例9: 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

示例10: getRootFilesFromContainer

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,代碼行數:35,代碼來源:EpubBook.java

示例11: readStrings

private static void readStrings(XmlPullParser parser) throws XmlPullParserException, IOException {
    parser.require(XmlPullParser.START_TAG, null, "resources");
    while (parser.next() != XmlPullParser.END_TAG) {
        if (parser.getEventType() != XmlPullParser.START_TAG) {
            continue;
        }
        String name = parser.getName();
        if (name.equals("string")) {
            readString(parser);
        } else {
            skip(parser);
        }
    }
}
 
開發者ID:mosquitolabs,項目名稱:referendum_1o_android,代碼行數:14,代碼來源:StringsManager.java

示例12: init

protected boolean init(Resources resources) {
    if (isReadDone()) {
        return true;
    }
    if (resources == null) {
        return false;
    }
    int resId = getFilterConfigId();
    XmlResourceParser parser = resources.getXml(resId);
    try {
        int event = parser.getEventType();
        while (event != XmlPullParser.END_DOCUMENT) {
            if (event == XmlPullParser.START_TAG) {
                if (!IconPackConfig.ICONPACKLABEL.equals(parser.getName())) {
                    event = parser.next();
                    continue;
                }
                Intent filter = new Intent();
                String action = parser.getAttributeValue(null,
                        IconPackConfig.ICONPACKACTIONELEMENT);
                if (TextUtils.isEmpty(action)) {
                    event = parser.next();
                    continue;
                }
                filter.setAction(action);
                String category = parser.getAttributeValue(null,
                        IconPackConfig.ICONPACKCATEGORYELEMENT);
                if (TextUtils.isEmpty(category)) {
                    event = parser.next();
                    continue;
                }
                filter.addCategory(category);

                mFilter.add(filter);
            }
            event = parser.next();
        }
        mDone = true;
        return true;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return false;
}
 
開發者ID:uchiaitachipro,項目名稱:icon_pack_loader,代碼行數:44,代碼來源:IconPackFilterReader.java

示例13: readFeed

public LocSample[] readFeed(XmlPullParser parser) {
    ArrayList<LocSample> lst = new ArrayList<>();

    LocSample sample = null;
    try {
        while (parser.next() != XmlPullParser.END_DOCUMENT) {
            try {
                int eventType = parser.getEventType();
                if (eventType == XmlPullParser.START_TAG) {
                    String name = parser.getName();
                    // Starts by looking for the entry tag
                    switch (name) {
                        case "trkpt":
                            sample = readTrkPoint(parser);
                            break;
                        case "ele":
                            readEle(sample, parser);
                            break;
                        case "time":
                            readTime(sample, parser);
                            break;
                        case "speed":
                            readSpeed(sample, parser);
                            break;
                    }
                } else if (eventType == XmlPullParser.END_TAG) {
                    if (parser.getName().equals("trkpt")) {
                        lst.add(sample);
                        sample = null;
                    }
                }
            }
            catch (XmlPullParserException ignored) { }
        }
    } catch (XmlPullParserException | IOException e) {
        e.printStackTrace();
    }

    return lst.toArray(new LocSample[0]);
}
 
開發者ID:ericberman,項目名稱:MyFlightbookAndroid,代碼行數:40,代碼來源:GPX.java

示例14: nextStartTag

/**
 * Next start tag.
 * 
 * @param parser the parser
 * 
 * @throws XmlPullParserException the xml pull parser exception
 * @throws IOException Signals that an I/O exception has occurred.
 */
public static void nextStartTag(XmlPullParser parser)
    throws XmlPullParserException, IOException
{
    if (parser.nextTag() != XmlPullParser.START_TAG) {
        throw new XmlPullParserException(
            "expected START_TAG but found: " + parser.getPositionDescription());
    }
}
 
開發者ID:Microsoft,項目名稱:healthvault-java-sdk,代碼行數:16,代碼來源:XmlUtils.java

示例15: 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


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