當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。