Android XmlPullParserException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android XmlPullParserException class.

This code example shows how to use the following methods:
                outBundle.putInt(name, v.data);
            } else if (v.type == TypedValue.TYPE_FLOAT) {
                outBundle.putFloat(name, v.getFloat());
            } else { 
                sa.recycle();
                throw new XmlPullParserException("<" + tagName
                        + "> only supports string, integer, float, color, and boolean at " 
                        + attrs.getPositionDescription());
            } 
        } else { 
            sa.recycle();
            throw new XmlPullParserException("<" + tagName
                    + "> requires an holo:value attribute at " + attrs.getPositionDescription());
        } 
        sa.recycle();
    } 
 
    private static Intent parseIntent(Resources resources, XmlPullParser parser, AttributeSet attrs)
            throws XmlPullParserException, IOException { 
        Intent intent = new Intent();
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getMessage, getColumnNumber, getDetail, getLineNumber
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: attribute, endTag, startTag, text
 
    private void addProblem(String tag, Throwable error) {
        try { 
            recordTestTime(); 
 
            mSerializer.startTag("", tag);
            mSerializer.attribute("", ATTRIBUTE_MESSAGE, safeMessage(error));
            mSerializer.attribute("", ATTRIBUTE_TYPE, error.getClass().getName());
            StringWriter w = new StringWriter();
            error.printStackTrace(mFilterTraces ? new FilteringWriter(w) : new PrintWriter(w));
            mSerializer.text(w.toString());
            mSerializer.endTag("", tag);
        } catch (IOException e) {
            Log.e(LOG_TAG, safeMessage(e));
        } 
    } 
 
    private void recordTestTime() throws IOException { 
        if (!mTimeAlreadyWritten) {
            mTimeAlreadyWritten = true;

9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getText, next, nextToken, setInput
        assertParseFailure("<foo><!-- -- --></foo>"); 
    } 
 
    public void testEmptyComment() throws Exception { 
        XmlPullParser parser = newPullParser();
        parser.setInput(new StringReader("<foo><!----></foo>"));
        assertEquals(XmlPullParser.START_TAG, parser.next());
        assertEquals(XmlPullParser.COMMENT, parser.nextToken());
        assertEquals("", parser.getText());
    } 
 
    /** 
     * Close braces require lookaheads because we need to defend against "]]>". 
     */ 
    public void testManyCloseBraces() throws Exception{ 
        XmlPullParser parser = newPullParser();
        parser.setInput(new StringReader("<foo>]]]]]]]]]]]]]]]]]]]]]]]</foo>"));
        assertEquals(XmlPullParser.START_TAG, parser.next());
        assertEquals(XmlPullParser.TEXT, parser.next());
        assertEquals("]]]]]]]]]]]]]]]]]]]]]]]", parser.getText());
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getName, getText, next, nextToken, setInput
    } 
 
    public void testDoctypeWithNextToken() throws Exception { 
        String xml = "<!DOCTYPE foo [<!ENTITY bb \"bar baz\">]><foo>a&bb;c</foo>";
        XmlPullParser parser = newPullParser(xml);
        assertEquals(XmlPullParser.DOCDECL, parser.nextToken());
        assertEquals(" foo [<!ENTITY bb \"bar baz\">]", parser.getText());
        assertNull(parser.getName());
        assertEquals(XmlPullParser.START_TAG, parser.nextToken());
        assertEquals(XmlPullParser.TEXT, parser.next());
        assertEquals("abar bazc", parser.getText());
        assertEquals(XmlPullParser.END_TAG, parser.next());
        assertEquals(XmlPullParser.END_DOCUMENT, parser.next());
    } 
 
    public void testDoctypeSpansBuffers() throws Exception { 
        char[] doctypeChars = new char[READ_BUFFER_SIZE + 1];
        Arrays.fill(doctypeChars, 'x');
        String doctypeBody = " foo [<!--" + new String(doctypeChars) + "-->]";
        String xml = "<!DOCTYPE" + doctypeBody + "><foo/>";

7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android XmlPullParserException Questions & Answers:

See Code Examples for Android XmlPullParserException Methods: