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


Java XmlPullParser.getName方法代码示例

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


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

示例1: handleEndTag

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
private void handleEndTag(XmlPullParser xml) {
  String strNode = xml.getName();
  if (strNode.equals(Constants.TAG_FEATURE)) {
    if (TextUtils.equals(Constants.CATEGORY_MODULE, mCategory)) {
      mModules.put(mApi, new PluginEntry(mApi, mPluginClass, mOnLoad, Constants.CATEGORY_MODULE));
    } else if (TextUtils.equals(Constants.CATEGORY_COMPONENT, mCategory)) {
      mComponents.put(mApi, new PluginEntry(mApi, mPluginClass, mOnLoad, Constants.CATEGORY_COMPONENT));
    }

    mService = "";
    mPluginClass = "";
    mInsideFeature = false;
    mOnLoad = false;
    mCategory = Constants.CATEGORY_MODULE;
    mApi = "";
    mParamType = "";
  }
}
 
开发者ID:wangwei123,项目名称:my-weex,代码行数:19,代码来源:ConfigXmlParser.java

示例2: readRecommendationConfig

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
private Map<String, String> readRecommendationConfig(XmlPullParser parser) throws XmlPullParserException, IOException {

        Map<String, String> retValue = new HashMap<>();
        while (parser.next() != XmlPullParser.END_TAG) {

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

            String name = parser.getName();
            if (name.equals("recommendation"))
            {
                parser.require(XmlPullParser.START_TAG, ns, "recommendation");
                String recName = parser.getAttributeValue(ns, "name");
                String value = readText(parser);

                if (recName == null || value == null || !HelperFunctions.testIsValidURL(value)) {
                    WebtrekkLogging.log("invalid parameter configuration while reading recommendation value, missing name or value or value URL incorrect");
                } else {
                    retValue.put(recName, value);
                }
            }
        }
        return retValue;
    }
 
开发者ID:Webtrekk,项目名称:webtrekk-android-sdk,代码行数:26,代码来源:TrackingConfigurationXmlParser.java

示例3: readCodeFiles

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
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,代码行数:20,代码来源:ExampleDefinitionParser.java

示例4: parse

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
Podcasts parse(InputStream input, @Nullable String charset, String baseUri) throws IOException {
    try {
        XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
        factory.setNamespaceAware(true);
        factory.setValidating(false);

        XmlPullParser xpp = factory.newPullParser();
        xpp.setInput(input, charset);

        int eventType = xpp.getEventType();
        while (eventType != XmlPullParser.END_DOCUMENT) {
            if (eventType == XmlPullParser.START_TAG) {
                String tag = xpp.getName();
                if (LayoutUtils.isDiv(tag) && hasClass(xpp, PODCAST_LIST_CLASS)) {
                    return parsePodcasts(xpp, NetworkUtils.toOptURI(baseUri));
                }
            }
            eventType = lenientNext(xpp);
        }
        return new Podcasts();
    } catch (XmlPullParserException e) {
        throw new IOException(e);
    }
}
 
开发者ID:kalikov,项目名称:lighthouse,代码行数:25,代码来源:PodcastsLayoutParser.java

示例5: beginDocument

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
protected static final void beginDocument(XmlPullParser parser, String firstElementName)
        throws XmlPullParserException, IOException {
    int type;
    while ((type = parser.next()) != XmlPullParser.START_TAG
            && type != XmlPullParser.END_DOCUMENT);

    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:michelelacorte,项目名称:FlickLauncher,代码行数:16,代码来源:AutoInstallsLayout.java

示例6: handleEndTag

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public void handleEndTag(XmlPullParser xml) {
    String strNode = xml.getName();
    if (strNode.equals("feature")) {
        pluginEntries.add(new PluginEntry(service, pluginClass, onload));

        service = "";
        pluginClass = "";
        insideFeature = false;
        onload = false;
    }
}
 
开发者ID:alex-shpak,项目名称:keemob,代码行数:12,代码来源:ConfigXmlParser.java

示例7: handleStartTag

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public void handleStartTag(XmlPullParser xml) {
    String strNode = xml.getName();
    if (strNode.equals("feature")) {
        //Check for supported feature sets  aka. plugins (Accelerometer, Geolocation, etc)
        //Set the bit for reading params
        insideFeature = true;
        service = xml.getAttributeValue(null, "name");
    }
    else if (insideFeature && strNode.equals("param")) {
        paramType = xml.getAttributeValue(null, "name");
        if (paramType.equals("service")) // check if it is using the older service param
            service = xml.getAttributeValue(null, "value");
        else if (paramType.equals("package") || paramType.equals("android-package"))
            pluginClass = xml.getAttributeValue(null,"value");
        else if (paramType.equals("onload"))
            onload = "true".equals(xml.getAttributeValue(null, "value"));
    }
    else if (strNode.equals("preference")) {
        String name = xml.getAttributeValue(null, "name").toLowerCase(Locale.ENGLISH);
        String value = xml.getAttributeValue(null, "value");
        prefs.set(name, value);
    }
    else if (strNode.equals("content")) {
        String src = xml.getAttributeValue(null, "src");
        if (src != null) {
            setStartUrl(src);
        }
    }
}
 
开发者ID:fachrihawari,项目名称:cordova-vuetify,代码行数:30,代码来源:ConfigXmlParser.java

示例8: handleEndTag

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
@Override
public void handleEndTag(final XmlPullParser xml) {
    if (didParseChcpBlock) {
        return;
    }

    final String name = xml.getName();
    if (XmlTags.MAIN_TAG.equals(name)) {
        didParseChcpBlock = true;
        isInsideChcpBlock = false;
    }
}
 
开发者ID:SUTFutureCoder,项目名称:localcloud_fe,代码行数:13,代码来源:ChcpXmlConfigParser.java

示例9: setParameterConfigurationFromXml

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
private void setParameterConfigurationFromXml(XmlPullParser parser, Map<String, String> values, Map<String, String> constValues) throws XmlPullParserException, IOException {

        while (parser.next() != XmlPullParser.END_TAG) {
            if (parser.getEventType() != XmlPullParser.START_TAG) {
                continue;
            }
            String name = parser.getName();
            if (name.equals("parameter")) {
                parser.require(XmlPullParser.START_TAG, ns, "parameter");
                // the id from the parameter identifies the parameter
                String id = parser.getAttributeValue(ns, "id");
                // the key is the key in the custom parameter object
                String key = parser.getAttributeValue(ns, "key");
                String value = readText(parser);

                if (id == null || (value == null && key == null)) {
                    WebtrekkLogging.log("invalid parameter configuration while reading parameter, missing key or value");
                } else {
                    // if no key is set, it is a const value
                    if(key == null) {
                        constValues.put(id, value);
                    } else {
                        // else its a mapped value which will be replaced at runtime
                        values.put(id, key);
                        //parser.nextTag();
                    }
                }

            } else {
                WebtrekkLogging.log("parameter: unknown xml tag: " + name);
                skip(parser);
            }
        }
    }
 
开发者ID:Webtrekk,项目名称:webtrekk-android-sdk,代码行数:35,代码来源:TrackingConfigurationXmlParser.java

示例10: parseRecords

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
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,代码行数:29,代码来源:PodcastLayoutParser.java

示例11: parserSimples

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public static List<String> parserSimples(String rssFeed) throws XmlPullParserException, IOException {
    // pegando instancia da XmlPullParserFactory [singleton]
    XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
    // criando novo objeto do tipo XmlPullParser
    XmlPullParser parser = factory.newPullParser();
    // Definindo a entrada do nosso parser - argumento passado como parametro
    parser.setInput(new StringReader(rssFeed));
    // Definindo retorno
    List<String> items = new ArrayList<String>();

    while (parser.next() != XmlPullParser.END_DOCUMENT) {
        if (parser.getEventType() == XmlPullParser.START_TAG) {
            String tag = parser.getName();
            //delimitando que estamos apenas interessados em tags <item>
            if (tag.equals("item")) {
                String title = "";
                while (parser.next() != XmlPullParser.END_TAG) {
                    if (parser.getEventType() == XmlPullParser.START_TAG) {
                        String tagAberta = parser.getName();
                        //pegando as tags <title>
                        if (tagAberta.equals("title")) {
                            title = parser.nextText();
                            items.add(title);
                        } else {
                            parser.next();
                        }
                        parser.nextTag();
                    }
                }
            }
        }
    }
    return items;
}
 
开发者ID:if1001,项目名称:tarefa01-blaandrade,代码行数:35,代码来源:ParserRSS.java

示例12: readStable

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
private void readStable(XmlPullParser parser) throws XmlPullParserException, IOException {
    while (parser.next() != XmlPullParser.END_TAG) {
        if (parser.getEventType() != XmlPullParser.START_TAG) {
            continue;
        }
        String name = parser.getName();
        if (name.equalsIgnoreCase(mDeviceName)) {
            readDevice(parser);
        } else {
            skip(parser);
        }
    }
}
 
开发者ID:DroidThug,项目名称:VulcanOTA,代码行数:14,代码来源:OTAParser.java

示例13: handleStartTag

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
private void handleStartTag(XmlPullParser xml) {
  String strNode = xml.getName();
  if (strNode.equals("preference")) {
    String name = xml.getAttributeValue(null, "name").toLowerCase(Locale.ENGLISH);
    String value = xml.getAttributeValue(null, "value");
    prefs.set(name, value);
  }
}
 
开发者ID:wangwei123,项目名称:my-weex,代码行数:9,代码来源:AppConfigXmlParser.java

示例14: parseAccount

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
private static ImportedAccount parseAccount(XmlPullParser xpp, List<String> accountUuids, boolean overview)
        throws XmlPullParserException, IOException {

    String uuid = xpp.getAttributeValue(null, SettingsExporter.UUID_ATTRIBUTE);

    try {
        UUID.fromString(uuid);
    } catch (Exception e) {
        skipToEndTag(xpp, SettingsExporter.ACCOUNT_ELEMENT);
        Timber.w("Skipping account with invalid UUID %s", uuid);
        return null;
    }

    ImportedAccount account = new ImportedAccount();
    account.uuid = uuid;

    if (overview || accountUuids.contains(uuid)) {
        int eventType = xpp.next();
        while (!(eventType == XmlPullParser.END_TAG && SettingsExporter.ACCOUNT_ELEMENT.equals(xpp.getName()))) {
            if (eventType == XmlPullParser.START_TAG) {
                String element = xpp.getName();
                if (SettingsExporter.NAME_ELEMENT.equals(element)) {
                    account.name = getText(xpp);
                } else if (SettingsExporter.INCOMING_SERVER_ELEMENT.equals(element)) {
                    if (overview) {
                        skipToEndTag(xpp, SettingsExporter.INCOMING_SERVER_ELEMENT);
                    } else {
                        account.incoming = parseServerSettings(xpp, SettingsExporter.INCOMING_SERVER_ELEMENT);
                    }
                } else if (SettingsExporter.OUTGOING_SERVER_ELEMENT.equals(element)) {
                    if (overview) {
                        skipToEndTag(xpp, SettingsExporter.OUTGOING_SERVER_ELEMENT);
                    } else {
                        account.outgoing = parseServerSettings(xpp, SettingsExporter.OUTGOING_SERVER_ELEMENT);
                    }
                } else if (SettingsExporter.SETTINGS_ELEMENT.equals(element)) {
                    if (overview) {
                        skipToEndTag(xpp, SettingsExporter.SETTINGS_ELEMENT);
                    } else {
                        account.settings = parseSettings(xpp, SettingsExporter.SETTINGS_ELEMENT);
                    }
                } else if (SettingsExporter.IDENTITIES_ELEMENT.equals(element)) {
                    account.identities = parseIdentities(xpp);
                } else if (SettingsExporter.FOLDERS_ELEMENT.equals(element)) {
                    if (overview) {
                        skipToEndTag(xpp, SettingsExporter.FOLDERS_ELEMENT);
                    } else {
                        account.folders = parseFolders(xpp);
                    }
                } else {
                    Timber.w("Unexpected start tag: %s", xpp.getName());
                }
            }
            eventType = xpp.next();
        }
    } else {
        skipToEndTag(xpp, SettingsExporter.ACCOUNT_ELEMENT);
        Timber.i("Skipping account with UUID %s", uuid);
    }

    // If we couldn't find an account name use the UUID
    if (account.name == null) {
        account.name = uuid;
    }

    return account;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:68,代码来源:SettingsImporter.java

示例15: parse

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public final Object parse(XmlPullParser xmlParser) throws XmlPullParserException, IOException,
    ParserException {
  String tagName;
  boolean foundStartTag = false;
  int skippingElementDepth = 0;
  while (true) {
    int eventType = xmlParser.getEventType();
    switch (eventType) {
      case XmlPullParser.START_TAG:
        tagName = xmlParser.getName();
        if (tag.equals(tagName)) {
          foundStartTag = true;
          parseStartTag(xmlParser);
        } else if (foundStartTag) {
          if (skippingElementDepth > 0) {
            skippingElementDepth++;
          } else if (handleChildInline(tagName)) {
            parseStartTag(xmlParser);
          } else {
            ElementParser childElementParser = newChildParser(this, tagName, baseUri);
            if (childElementParser == null) {
              skippingElementDepth = 1;
            } else {
              addChild(childElementParser.parse(xmlParser));
            }
          }
        }
        break;
      case XmlPullParser.TEXT:
        if (foundStartTag && skippingElementDepth == 0) {
          parseText(xmlParser);
        }
        break;
      case XmlPullParser.END_TAG:
        if (foundStartTag) {
          if (skippingElementDepth > 0) {
            skippingElementDepth--;
          } else {
            tagName = xmlParser.getName();
            parseEndTag(xmlParser);
            if (!handleChildInline(tagName)) {
              return build();
            }
          }
        }
        break;
      case XmlPullParser.END_DOCUMENT:
        return null;
      default:
        // Do nothing.
        break;
    }
    xmlParser.next();
  }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:56,代码来源:SmoothStreamingManifestParser.java


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