} else if(expect.getEventType() == expect.TEXT) {
} else if(expect.getEventType() == XmlPullParser.TEXT) {
    private void assertXmlEquals(String expectedXml, String actualXml)        throws Exception    {        XmlPullParser expect = factory.newPullParser();        expect.setInput(new StringReader(expectedXml));        XmlPullParser actual = factory.newPullParser();        actual.setInput(new StringReader(actualXml));        while(true) {            expect.next();            actual.next();            assertXml("inconsistent event type", expect, actual,                      expect.TYPES[ expect.getEventType() ],                      actual.TYPES[ actual.getEventType() ]                     );            if(expect.getEventType() == expect.END_DOCUMENT) {                break;            }            if(expect.getEventType() == expect.START_TAG                   || expect.getEventType() == expect.END_TAG )            {                assertXml("tag names", expect, actual,                          expect.getName(), actual.getName());                assertXml("tag namespaces", expect, actual,                          expect.getNamespace(), actual.getNamespace());                if(expect.getEventType() == expect.START_TAG) {                    // check consisteny of attributes -- allow them to be in any order                    int expectAttrCount = expect.getAttributeCount();                    assertXml("attributes count", expect, actual,                              ""+expectAttrCount, ""+actual.getAttributeCount());                    for (int i = 0; i < expectAttrCount; i++)                    {                        String expectAttrNamespace = expect.getAttributeNamespace(i);                        String expectAttrName = expect.getAttributeName(i);                        String expectAttrType = expect.getAttributeType(i);                        String expectAttrValue = expect.getAttributeValue(i);                        boolean expectAttrDefault = expect.isAttributeDefault(i);                                                // find this attribute actual position                        int actualPos = -1;                        for (int j = 0; j < expectAttrCount; j++)                        {                            if(expectAttrNamespace.equals(actual.getAttributeNamespace(j))                                   && expectAttrName.equals(actual.getAttributeName(j)))                            {                                actualPos = j;                                break;                            }                        }                        String expectN = expectAttrNamespace+":"+expectAttrName;                        if(actualPos == -1) {                            fail("could not find expected attribute "+expectN                                     +" actual parser "+actual.getPositionDescription());                        }                                                //and compare ...                        assertXml("attribute "+expectN+" namespace", expect, actual,                                  expectAttrNamespace, actual.getAttributeNamespace(actualPos) );                        assertXml("attribute "+expectN+" name", expect, actual,                                  expectAttrName, actual.getAttributeName(actualPos) );                        assertXml("attribute "+expectN+" type", expect, actual,                                  expectAttrType, actual.getAttributeType(actualPos) );                        assertXml("attribute "+expectN+" value", expect, actual,                                  expectAttrValue, actual.getAttributeValue(actualPos) );                        assertXml("attribute "+expectN+" default", expect, actual,                                  ""+expectAttrDefault, ""+actual.isAttributeDefault(actualPos) );                    }                }            } else if(expect.getEventType() == expect.TEXT) {                assertXml("text content", expect, actual,                          expect.getText(), actual.getText());            } else {                fail("unexpected event type "+expect.getEventType()+" "+expect.getPositionDescription());            }            //System.err.print(".");        }        //System.err.println("\nOK");    }