XmlPullParser.END_DOCUMENT parseExtension

I understand now.

We do not use XmlPullParser.END_DOCUMENT in PacketExtensionProvider.parseExtension(XmlPullParser parser). We can use XmlPullParser.END_TAG with parser.getName() and compare the tag with our extension root (such as CustomExtension).

Right?

From

http://www.jivesoftware.org/builds/smack/docs/latest/javadoc/org/jivesoftware/sm ack/provider/PacketExtensionProvider.html

I see the following “At the end of the method call, the parser must be positioned on the closing element of the packet extension.”

So, the answer is yes. In order to comply with the interface method requirement of having the parser be positioned on the closing element of the packet extension, using XmlPullParser.END_TAG and parser.getName() is required.