Code example for XmlPullParser

Methods: getName, getText, next, nextToken, setFeature, setInput

0
        testMissingEntitiesUsingNextToken(parser);
    } 
 
    public void testMissingEntitiesUsingNextTokenWithRelaxed() throws Exception { 
        XmlPullParser parser = newPullParser();
        parser.setFeature("http://xmlpull.org/v1/doc/features.html#relaxed", true);
        testMissingEntitiesUsingNextToken(parser);
    } 
 
    private void testMissingEntitiesUsingNextToken(XmlPullParser parser) throws Exception {
        parser.setInput(new StringReader("<foo>&aaa;</foo>"));
        assertEquals(XmlPullParser.START_TAG, parser.nextToken());
        assertEquals(XmlPullParser.ENTITY_REF, parser.nextToken());
        assertEquals("aaa", parser.getName());
        assertEquals(null, parser.getText());
        assertEquals(XmlPullParser.END_TAG, parser.next());
    } 
 
    public void testEntityInAttributeUsingNextToken() throws Exception { 
        XmlPullParser parser = newPullParser();
        parser.setInput(new StringReader("<foo bar=\"&amp;\"></foo>"));