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


Java XmlPullParserException类代码示例

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


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

示例1: parse

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

示例2: readScriptId

import org.xmlpull.v1.XmlPullParserException; //导入依赖的package包/类
static int readScriptId(final Resources resources, final InputMethodSubtype subtype) {
    final String layoutSetName = KEYBOARD_LAYOUT_SET_RESOURCE_PREFIX
            + SubtypeLocaleUtils.getKeyboardLayoutSetName(subtype);
    final int xmlId = getXmlId(resources, layoutSetName);
    final XmlResourceParser parser = resources.getXml(xmlId);
    try {
        while (parser.getEventType() != XmlPullParser.END_DOCUMENT) {
            // Bovinate through the XML stupidly searching for TAG_FEATURE, and read
            // the script Id from it.
            parser.next();
            final String tag = parser.getName();
            if (TAG_FEATURE.equals(tag)) {
                return readScriptIdFromTagFeature(resources, parser);
            }
        }
    } catch (final IOException | XmlPullParserException e) {
        throw new RuntimeException(e.getMessage() + " in " + layoutSetName, e);
    } finally {
        parser.close();
    }
    // If the tag is not found, then the default script is Latin.
    return ScriptUtils.SCRIPT_LATIN;
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:24,代码来源:KeyboardLayoutSet.java

示例3: parseAndAdd

import org.xmlpull.v1.XmlPullParserException; //导入依赖的package包/类
@Override
public long parseAndAdd(XmlResourceParser parser) throws XmlPullParserException,
        IOException {
    final int groupDepth = parser.getDepth();
    int type;
    long addedId = -1;
    while ((type = parser.next()) != XmlPullParser.END_TAG ||
            parser.getDepth() > groupDepth) {
        if (type != XmlPullParser.START_TAG || addedId > -1) {
            continue;
        }
        final String fallback_item_name = parser.getName();
        if (TAG_FAVORITE.equals(fallback_item_name)) {
            addedId = mChildParser.parseAndAdd(parser);
        } else {
            Log.e(TAG, "Fallback groups can contain only favorites, found "
                    + fallback_item_name);
        }
    }
    return addedId;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:22,代码来源:DefaultLayoutParser.java

示例4: inflate

import org.xmlpull.v1.XmlPullParserException; //导入依赖的package包/类
public void inflate(int menuRes, Menu menu) {
    if (menu instanceof SupportMenu) {
        XmlResourceParser parser = null;
        try {
            parser = this.mContext.getResources().getLayout(menuRes);
            parseMenu(parser, Xml.asAttributeSet(parser), menu);
            if (parser != null) {
                parser.close();
            }
        } catch (XmlPullParserException e) {
            throw new InflateException("Error inflating menu XML", e);
        } catch (IOException e2) {
            throw new InflateException("Error inflating menu XML", e2);
        } catch (Throwable th) {
            if (parser != null) {
                parser.close();
            }
        }
    } else {
        super.inflate(menuRes, menu);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:SupportMenuInflater.java

示例5: getPIData

import org.xmlpull.v1.XmlPullParserException; //导入依赖的package包/类
public static String getPIData(XmlPullParser var0) throws IllegalStateException {
   int var1;
   try {
      var1 = var0.getEventType();
   } catch (XmlPullParserException var5) {
      throw new IllegalStateException("could not determine parser state: " + var5 + var0.getPositionDescription());
   }

   if(var1 != 8) {
      throw new IllegalStateException("parser must be on processing instruction and not " + XmlPullParser.TYPES[var1] + var0.getPositionDescription());
   } else {
      String var2 = var0.getText();
      int var3 = -1;

      for(int var4 = 0; var4 < var2.length(); ++var4) {
         if(isS(var2.charAt(var4))) {
            var3 = var4;
         } else if(var3 > 0) {
            return var2.substring(var4);
         }
      }

      return "";
   }
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:26,代码来源:XmlPullUtil.java

示例6: writeSetXml

import org.xmlpull.v1.XmlPullParserException; //导入依赖的package包/类
public static final void writeSetXml(Set val, String name, XmlSerializer out)
        throws XmlPullParserException, java.io.IOException {
    if (val == null) {
        out.startTag(null, "null");
        out.endTag(null, "null");
        return;
    }
    
    out.startTag(null, "set");
    if (name != null) {
        out.attribute(null, "name", name);
    }
    
    for (Object v : val) {
        writeValueXml(v, null, out);
    }
    
    out.endTag(null, "set");
}
 
开发者ID:ukanth,项目名称:XPrivacy,代码行数:20,代码来源:XmlUtils.java

示例7: parseServerSettings

import org.xmlpull.v1.XmlPullParserException; //导入依赖的package包/类
private static ImportedServer parseServerSettings(XmlPullParser xpp, String endTag)
        throws XmlPullParserException, IOException {
    ImportedServer server = new ImportedServer();

    server.type = xpp.getAttributeValue(null, SettingsExporter.TYPE_ATTRIBUTE);

    int eventType = xpp.next();
    while (!(eventType == XmlPullParser.END_TAG && endTag.equals(xpp.getName()))) {
        if (eventType == XmlPullParser.START_TAG) {
            String element = xpp.getName();
            if (SettingsExporter.HOST_ELEMENT.equals(element)) {
                server.host = getText(xpp);
            } else if (SettingsExporter.PORT_ELEMENT.equals(element)) {
                server.port = getText(xpp);
            } else if (SettingsExporter.CONNECTION_SECURITY_ELEMENT.equals(element)) {
                server.connectionSecurity = getText(xpp);
            } else if (SettingsExporter.AUTHENTICATION_TYPE_ELEMENT.equals(element)) {
                String text = getText(xpp);
                server.authenticationType = AuthType.valueOf(text);
            } else if (SettingsExporter.USERNAME_ELEMENT.equals(element)) {
                server.username = getText(xpp);
            } else if (SettingsExporter.CLIENT_CERTIFICATE_ALIAS_ELEMENT.equals(element)) {
                server.clientCertificateAlias = getText(xpp);
            } else if (SettingsExporter.PASSWORD_ELEMENT.equals(element)) {
                server.password = getText(xpp);
            } else if (SettingsExporter.EXTRA_ELEMENT.equals(element)) {
                server.extras = parseSettings(xpp, SettingsExporter.EXTRA_ELEMENT);
            } else {
                Timber.w("Unexpected start tag: %s", xpp.getName());
            }
        }
        eventType = xpp.next();
    }

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

示例8: skip

import org.xmlpull.v1.XmlPullParserException; //导入依赖的package包/类
private static void skip(final 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;
            default:
                break;
        }
    }
}
 
开发者ID:Applications-Development,项目名称:SimpleRssReader,代码行数:22,代码来源:OPMLParser.java

示例9: action

import org.xmlpull.v1.XmlPullParserException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void action( Dsmlv2Container container ) throws XmlPullParserException
{
    XmlPullParser xpp = container.getParser();
    SearchResponse searchResponse;

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

    if ( attributeValue != null )
    {
        searchResponse = new SearchResponse(
            ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
    }
    else
    {
        searchResponse = new SearchResponse();
    }

    container.getBatchResponse().addResponse( new SearchResponseDsml(
        container.getLdapCodecService(), searchResponse ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:26,代码来源:Dsmlv2ResponseGrammar.java

示例10: skip

import org.xmlpull.v1.XmlPullParserException; //导入依赖的package包/类
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:michelelacorte,项目名称:FlickLauncher,代码行数:17,代码来源:ShortcutPackageParser.java

示例11: parseRowAttributes

import org.xmlpull.v1.XmlPullParserException; //导入依赖的package包/类
private KeyboardRow parseRowAttributes(final XmlPullParser parser)
        throws XmlPullParserException {
    final AttributeSet attr = Xml.asAttributeSet(parser);
    final TypedArray keyboardAttr = mResources.obtainAttributes(attr, R.styleable.Keyboard);
    try {
        if (keyboardAttr.hasValue(R.styleable.Keyboard_horizontalGap)) {
            throw new XmlParseUtils.IllegalAttribute(parser, TAG_ROW, "horizontalGap");
        }
        if (keyboardAttr.hasValue(R.styleable.Keyboard_verticalGap)) {
            throw new XmlParseUtils.IllegalAttribute(parser, TAG_ROW, "verticalGap");
        }
        return new KeyboardRow(mResources, mParams, parser, mCurrentY);
    } finally {
        keyboardAttr.recycle();
    }
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:17,代码来源:KeyboardBuilder.java

示例12: getXmlPullParser

import org.xmlpull.v1.XmlPullParserException; //导入依赖的package包/类
/**
 * Creates a pull parser with the given input and gobbles up to the first start tag that equals
 * {@code returnFirstInstanceOf}.
 */
private XmlPullParser getXmlPullParser(String input, String returnFirstInstanceOf) {
    try {
        xmlPullParserFactory.setNamespaceAware(true);
        XmlPullParser parser = xmlPullParserFactory.newPullParser();

        parser.setInput(new ByteArrayInputStream(input.getBytes()), null);

        int eventType = parser.getEventType();
        while (eventType != XmlPullParser.END_DOCUMENT) {
            if (eventType == XmlPullParser.START_TAG
                    && parser.getName().equalsIgnoreCase(returnFirstInstanceOf)) {
                return parser;
            }
            eventType = parser.next();
        }
    } catch (XmlPullParserException | IOException e) {
        throw new IllegalStateException(e);
    }
    return null;
}
 
开发者ID:Axe-Ishmael,项目名称:Blockly,代码行数:25,代码来源:BlockFactoryTest.java

示例13: parseMerge

import org.xmlpull.v1.XmlPullParserException; //导入依赖的package包/类
private void parseMerge(final XmlPullParser parser, final KeyboardRow row, final boolean skip)
        throws XmlPullParserException, IOException {
    if (DEBUG) startTag("<%s>", TAG_MERGE);
    while (parser.getEventType() != XmlPullParser.END_DOCUMENT) {
        final int event = parser.next();
        if (event == XmlPullParser.START_TAG) {
            final String tag = parser.getName();
            if (TAG_MERGE.equals(tag)) {
                if (row == null) {
                    parseKeyboardContent(parser, skip);
                } else {
                    parseRowContent(parser, row, skip);
                }
                return;
            }
            throw new XmlParseUtils.ParseException(
                    "Included keyboard layout must have <merge> root element", parser);
        }
    }
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:21,代码来源:KeyboardBuilder.java

示例14: writeBooleanArrayXml

import org.xmlpull.v1.XmlPullParserException; //导入依赖的package包/类
private static void writeBooleanArrayXml(boolean[] val, String name, XmlSerializer out)
        throws XmlPullParserException, IOException {
    if (val == null) {
        out.startTag(null, "null");
        out.endTag(null, "null");
        return;
    }

    out.startTag(null, "boolean-array");
    if (name != null) {
        out.attribute(null, "name", name);
    }

    final int N = val.length;
    out.attribute(null, "num", Integer.toString(N));

    for (int i = 0; i < N; i++) {
        out.startTag(null, "item");
        out.attribute(null, "value", Boolean.toString(val[i]));
        out.endTag(null, "item");
    }

    out.endTag(null, "boolean-array");
}
 
开发者ID:Doist,项目名称:JobSchedulerCompat,代码行数:25,代码来源:XmlUtils.java

示例15: skipXmlTagParse

import org.xmlpull.v1.XmlPullParserException; //导入依赖的package包/类
private void skipXmlTagParse(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:malah-code,项目名称:Open-Quran-Radio,代码行数:17,代码来源:Station.java


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