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


Java XmlResourceParser.START_TAG屬性代碼示例

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


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

示例1: parse

private void parse() {
    try {
        parser.next();
        int eventType = parser.getEventType();

        while (eventType != XmlResourceParser.END_DOCUMENT) {
            if(eventType == XmlResourceParser.START_TAG) {
                parseNewTab(parser);
            } else if(eventType == XmlResourceParser.END_TAG) {
                if (parser.getName().equals("tab")) {
                    if (workingTab != null) {
                        tabs.add(workingTab);
                        workingTab = null;
                    }
                }
            }

            eventType = parser.next();
        }
    } catch (IOException | XmlPullParserException e) {
        e.printStackTrace();
        throw new TabParserException();
    }
}
 
開發者ID:A-Miracle,項目名稱:QiangHongBao,代碼行數:24,代碼來源:TabParser.java

示例2: findProviderForDomain

private Provider findProviderForDomain(String domain) {
    try {
        XmlResourceParser xml = getResources().getXml(R.xml.providers);
        int xmlEventType;
        Provider provider = null;
        while ((xmlEventType = xml.next()) != XmlResourceParser.END_DOCUMENT) {
            if (xmlEventType == XmlResourceParser.START_TAG
                    && "provider".equals(xml.getName())
                    && domain.equalsIgnoreCase(getXmlAttribute(xml, "domain"))) {
                provider = new Provider();
                provider.id = getXmlAttribute(xml, "id");
                provider.label = getXmlAttribute(xml, "label");
                provider.domain = getXmlAttribute(xml, "domain");
                provider.note = getXmlAttribute(xml, "note");
            } else if (xmlEventType == XmlResourceParser.START_TAG
                       && "incoming".equals(xml.getName())
                       && provider != null) {
                provider.incomingUriTemplate = new URI(getXmlAttribute(xml, "uri"));
                provider.incomingUsernameTemplate = getXmlAttribute(xml, "username");
            } else if (xmlEventType == XmlResourceParser.START_TAG
                       && "outgoing".equals(xml.getName())
                       && provider != null) {
                provider.outgoingUriTemplate = new URI(getXmlAttribute(xml, "uri"));
                provider.outgoingUsernameTemplate = getXmlAttribute(xml, "username");
            } else if (xmlEventType == XmlResourceParser.END_TAG
                       && "provider".equals(xml.getName())
                       && provider != null) {
                return provider;
            }
        }
    } catch (Exception e) {
        Timber.e(e, "Error while trying to load provider settings.");
    }
    return null;
}
 
開發者ID:philipwhiuk,項目名稱:q-mail,代碼行數:35,代碼來源:AccountSetupBasics.java

示例3: readValidCertificates

private Map<String, ArrayList<CallerInfo>> readValidCertificates(XmlResourceParser parser) {
    HashMap<String, ArrayList<CallerInfo>> validCertificates = new HashMap<>();
    try {
        int eventType = parser.next();
        while (eventType != XmlResourceParser.END_DOCUMENT) {
            if (eventType == XmlResourceParser.START_TAG
                    && parser.getName().equals("signing_certificate")) {

                String name = parser.getAttributeValue(null, "name");
                String packageName = parser.getAttributeValue(null, "package");
                boolean isRelease = parser.getAttributeBooleanValue(null, "release", false);
                String certificate = parser.nextText().replaceAll("\\s|\\n", "");

                CallerInfo info = new CallerInfo(name, packageName, isRelease);

                ArrayList<CallerInfo> infos = validCertificates.get(certificate);
                if (infos == null) {
                    infos = new ArrayList<>();
                    validCertificates.put(certificate, infos);
                }
                /*Log.v(TAG, "Adding allowed caller: " + info.name +
                        " package=" + info.packageName + " release=" + info.release +
                        " certificate=" + certificate);*/
                infos.add(info);
            }
            eventType = parser.next();
        }
    } catch (XmlPullParserException | IOException e) {
        Log.e(TAG, e + "Could not read allowed callers from XML.");
    }
    return validCertificates;
}
 
開發者ID:h4h13,項目名稱:RetroMusicPlayer,代碼行數:32,代碼來源:PackageValidator.java


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