xpp.setFeature(xpp.FEATURE_PROCESS_DOCDECL, true);
xpp.setFeature(XmlPullParser.FEATURE_PROCESS_DOCDECL, true);
    public void testProcessDocdecl() throws Exception {        XmlPullParser xpp = factory.newPullParser();        try {            xpp.setFeature(xpp.FEATURE_PROCESS_DOCDECL, true);        } catch(XmlPullParserException ex) {            return;        }        PackageTests.addNote("* feature "+xpp.FEATURE_PROCESS_DOCDECL+" is supported\n");        // setting validation MUST enables also PROCESS_DOCDECL        assertEquals(true, xpp.getFeature(XmlPullParser.FEATURE_PROCESS_DOCDECL));        // default is to have non-validating parser        assertEquals(false, xpp.getFeature(XmlPullParser.FEATURE_VALIDATION));        //http://www.w3.org/TR/REC-xml#NT-extSubsetDecl        // minimum validation        final String XML_MIN_PROLOG =            "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone='yes' ?>\n"+            "<!DOCTYPE greeting [\n"+            "<!ENTITY name \"world\">\n"+            "]>\n";        final String XML_MIN_VALID = XML_MIN_PROLOG+            "<greeting>Hello, &name;!</greeting>\n";        xpp.setInput(new StringReader( XML_MIN_VALID ));        checkParserStateNs(xpp, 0, xpp.START_DOCUMENT, null, 0, null, null, null, false, -1);        assertNull(xpp.getProperty(PROPERTY_XMLDECL_VERSION));        assertNull(xpp.getProperty(PROPERTY_XMLDECL_STANDALONE));        assertNull(xpp.getProperty(PROPERTY_XMLDECL_CONTENT));        xpp.next();        checkParserStateNs(xpp, 1, xpp.START_TAG, null, 0, "", "greeting", null, false/*empty*/, 0);        //XMLDecl support is required when PROCESS DOCDECL enabled        assertEquals("1.0", xpp.getProperty(PROPERTY_XMLDECL_VERSION));        assertEquals(Boolean.TRUE, xpp.getProperty(PROPERTY_XMLDECL_STANDALONE));        xpp.next();        checkParserStateNs(xpp, 1, xpp.TEXT, null, 0, null, null, "Hello, world!", false, -1);        xpp.next();        checkParserStateNs(xpp, 1, xpp.END_TAG, null, 0, "", "greeting", null, false, -1);        xpp.next();        checkParserStateNs(xpp, 0, xpp.END_DOCUMENT, null, 0, null, null, null, false, -1);        //AND WRONG        final String XML_MIN_INVALID = XML_MIN_PROLOG+            "<greet>Hello, &world;!</greet>\n";        xpp.setInput(new StringReader( XML_MIN_INVALID ));        checkParserStateNs(xpp, 0, xpp.START_DOCUMENT, null, 0, null, null, null, false, -1);        xpp.next();        checkParserStateNs(xpp, 1, xpp.START_TAG, null, 0, "", "greet", null, false/*empty*/, 0);        try {            xpp.next();            fail("exception was expected of next() for undeclared entity");        } catch(XmlPullParserException ex) {}    }