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