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


Java XmlPullParser.getAttributeValue方法代码示例

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


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

示例1: handleStartTag

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
private void handleStartTag(XmlPullParser xml) {
  String strNode = xml.getName();
  if (strNode.equals(Constants.TAG_FEATURE)) {
    mInsideFeature = true;
    mService = xml.getAttributeValue(null, Constants.ATTR_NAME);
  } else if (mInsideFeature && strNode.equals(Constants.TAG_PARAM)) {
    mParamType = xml.getAttributeValue(null, Constants.ATTR_NAME);
    if (mParamType.equals(Constants.ATTR_SERVICE)) // check if it is using the older mService param
      mService = xml.getAttributeValue(null, Constants.ATTR_VALUE);
    else if (mParamType.equals(Constants.ATTR_PACKAGE) || mParamType.equals(Constants.ATTR_ANDROID_PACKAGE))
      mPluginClass = xml.getAttributeValue(null, Constants.ATTR_VALUE);
    else if (mParamType.equals(Constants.ATTR_ONLOAD))
      mOnLoad = "true".equals(xml.getAttributeValue(null, Constants.ATTR_VALUE));
    else if (mParamType.equals(Constants.ATTR_CATEGORY))
      mCategory = xml.getAttributeValue(null, Constants.ATTR_VALUE);
    else if (mParamType.equals(Constants.ATTR_API))
      mApi = xml.getAttributeValue(null, Constants.ATTR_VALUE);
  }
}
 
开发者ID:osmartian,项目名称:martian-cli,代码行数:20,代码来源:ConfigXmlParser.java

示例2: parseStreamElementStartTag

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
private void parseStreamElementStartTag(XmlPullParser parser) throws ParserException {
  type = parseType(parser);
  putNormalizedAttribute(KEY_TYPE, type);
  if (type == StreamElement.TYPE_TEXT) {
    subType = parseRequiredString(parser, KEY_SUB_TYPE);
  } else {
    subType = parser.getAttributeValue(null, KEY_SUB_TYPE);
  }
  name = parser.getAttributeValue(null, KEY_NAME);
  qualityLevels = parseInt(parser, KEY_QUALITY_LEVELS, -1);
  url = parseRequiredString(parser, KEY_URL);
  maxWidth = parseInt(parser, KEY_MAX_WIDTH, -1);
  maxHeight = parseInt(parser, KEY_MAX_HEIGHT, -1);
  displayWidth = parseInt(parser, KEY_DISPLAY_WIDTH, -1);
  displayHeight = parseInt(parser, KEY_DISPLAY_HEIGHT, -1);
  language = parser.getAttributeValue(null, KEY_LANGUAGE);
  putNormalizedAttribute(KEY_LANGUAGE, language);
  timescale = parseInt(parser, KEY_TIME_SCALE, -1);
  if (timescale == -1) {
    timescale = (Long) getNormalizedAttribute(KEY_TIME_SCALE);
  }
  startTimes = new ArrayList<>();
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:24,代码来源:SmoothStreamingManifestParser.java

示例3: 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:Andy-Ta,项目名称:COB,代码行数:30,代码来源:ConfigXmlParser.java

示例4: action

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void action( Dsmlv2Container container ) throws XmlPullParserException
{
    PresentFilter presentFilter = new PresentFilter();

    XmlPullParser xpp = container.getParser();

    // Adding the filter to the Search Filter
    SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
        container.getBatchRequest().getCurrentRequest();

    try
    {
        searchRequestDecorator.addCurrentFilter( presentFilter );
    }
    catch ( DecoderException de )
    {
        throw new XmlPullParserException( de.getMessage(), xpp, de );
    }

    // Checking and adding the filter's attributes
    String attributeValue;
    // name
    attributeValue = xpp.getAttributeValue( "", NAME );

    if ( attributeValue != null )
    {
        presentFilter.setAttributeDescription( attributeValue );
    }
    else
    {
        throw new XmlPullParserException( "name attribute is required", xpp, null );
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:38,代码来源:Dsmlv2Grammar.java

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

示例6: readLongAttribute

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
private long readLongAttribute(XmlPullParser parser, String attr, long defaultValue) {
    String valueString = parser.getAttributeValue(null, attr);
    if (valueString == null) return defaultValue;
    try {
        return Long.parseLong(valueString);
    } catch (NumberFormatException nfe) {
        return defaultValue;
    }
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:10,代码来源:VUserManagerService.java

示例7: processACL

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
/**
 * Process ACL definition
 * 
 * @param xpp XmlPullParser
 * @param parserContext ParserContext
 */
private void processACL(XmlPullParser xpp, ParserContext parserContext)
{
    NodeContext node = peekNodeContext(parserContext.elementStack);
    
    String strInherit = xpp.getAttributeValue(NamespaceService.REPOSITORY_VIEW_1_0_URI, VIEW_INHERIT_PERMISSIONS_ATTR);
    if (strInherit != null)
    {
        Boolean inherit = Boolean.valueOf(strInherit);
        if (!inherit)
        {
            node.setInheritPermissions(false);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:ViewParser.java

示例8: onStartReadXmlTag

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
/**
 * XML interface: callback on start of an xml tag reading
 */
public boolean onStartReadXmlTag(XmlPullParser parser)
{
    if (getBaseType().toString().equalsIgnoreCase(parser.getName()))
    {
        String attr = parser.getAttributeValue(null, FormulaList.XML_PROP_INRIGHTOFPREVIOUS);
        if (attr != null)
        {
            inRightOfPrevious = Boolean.valueOf(attr);
        }
    }
    return false;
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:16,代码来源:FormulaBase.java

示例9: readFromXml

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public void readFromXml(XmlPullParser parser)
{
    final DecimalFormat df = CompatUtils.getDecimalFormat("0.00000");
    String attr = parser.getAttributeValue(null, XML_PROP_VERSION);
    documentVersion = (attr != null)? Integer.parseInt(attr) : DEFAULT_DOCUMENT_VERSION;
    attr = parser.getAttributeValue(null, XML_PROP_TEXT_WIDTH);
    if (attr != null)
    {
        textWidth = Integer.parseInt(attr);
    }
    attr = parser.getAttributeValue(null, XML_PROP_SIGNIFICANT_DIGITS);
    if (attr != null)
    {
        significantDigits = Integer.parseInt(attr);
    }
    attr = parser.getAttributeValue(null, XML_PROP_SCALE);
    if (attr != null)
    {
        try
        {
            scaledDimensions.setScaleFactor(df.parse(attr).floatValue());
        }
        catch (ParseException e)
        {
            scaledDimensions.setScaleFactor(1.0f);
        }
    }
    attr = parser.getAttributeValue(null, XML_PROP_REDEFINE_ALLOWED);
    if (attr != null)
    {
        redefineAllowed = Boolean.parseBoolean(attr);
    }
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:34,代码来源:DocumentProperties.java

示例10: action

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void action( Dsmlv2Container container ) throws XmlPullParserException
{
    ModDNResponseDsml modDNResponse = new ModDNResponseDsml(
        container.getLdapCodecService(), new ModifyDnResponseImpl() );
    container.getBatchResponse().addResponse( modDNResponse );

    LdapResult ldapResult = modDNResponse.getLdapResult();

    XmlPullParser xpp = container.getParser();

    // Checking and adding the batchRequest's attributes
    String attributeValue;
    // requestID
    attributeValue = xpp.getAttributeValue( "", "requestID" );

    if ( attributeValue != null )
    {
        modDNResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
    }

    // MatchedDN
    attributeValue = xpp.getAttributeValue( "", "matchedDN" );

    if ( attributeValue != null )
    {
        try
        {
            ldapResult.setMatchedDn( new Dn( attributeValue ) );
        }
        catch ( LdapInvalidDnException lide )
        {
            throw new XmlPullParserException( lide.getMessage(), xpp, lide );
        }
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:40,代码来源:Dsmlv2ResponseGrammar.java

示例11: parseRequiredString

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
protected final String parseRequiredString(XmlPullParser parser, String key)
    throws MissingFieldException {
  String value = parser.getAttributeValue(null, key);
  if (value != null) {
    return value;
  } else {
    throw new MissingFieldException(key);
  }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:10,代码来源:SmoothStreamingManifestParser.java

示例12: readIntAttribute

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public static int readIntAttribute(XmlPullParser in, String name, int defaultValue) {
    final String value = in.getAttributeValue(null, name);
    if (TextUtils.isEmpty(value)) {
        return defaultValue;
    }
    try {
        return Integer.parseInt(value);
    } catch (NumberFormatException e) {
        return defaultValue;
    }
}
 
开发者ID:ukanth,项目名称:XPrivacy,代码行数:12,代码来源:XmlUtils.java

示例13: readUrl

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
private static void readUrl(XmlPullParser parser, SearchEngine searchEngine) throws XmlPullParserException, IOException {
    parser.require(XmlPullParser.START_TAG, null, "Url");

    final String type = parser.getAttributeValue(null, "type");
    final String template = parser.getAttributeValue(null, "template");
    final String rel = parser.getAttributeValue(null, "rel");

    Uri uri = Uri.parse(template);

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

        final String tag = parser.getName();

        if (tag.equals("Param")) {
            final String name = parser.getAttributeValue(null, "name");
            final String value = parser.getAttributeValue(null, "value");
            uri = uri.buildUpon().appendQueryParameter(name, value).build();
            parser.nextTag();
        } else {
            skip(parser);
        }
    }

    if (type.equals(URLTYPE_SEARCH_HTML)) {
        // Prefer mobile URIs.
        if (rel != null && rel.equals(URL_REL_MOBILE)) {
            searchEngine.resultsUris.add(0, uri);
        } else {
            searchEngine.resultsUris.add(uri);
        }
    } else if (type.equals(URLTYPE_SUGGEST_JSON)) {
        searchEngine.suggestUri = uri;
    }
}
 
开发者ID:mozilla-mobile,项目名称:firefox-tv,代码行数:38,代码来源:SearchEngineParser.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: readTrkPoint

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
private LocSample readTrkPoint(XmlPullParser parser) {
    String szLat = parser.getAttributeValue(null, "lat");
    String szLon = parser.getAttributeValue(null, "lon");

    return new LocSample(Double.parseDouble(szLat), Double.parseDouble(szLon), 0, 0, 1.0, "");
}
 
开发者ID:ericberman,项目名称:MyFlightbookAndroid,代码行数:7,代码来源:GPX.java


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