mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-12 14:01:08 +01:00
Replace XPP3 by XmlPullParser interface wrapping StAX and XPP3
Introducing Smack's own XmlPullParser interface which tries to stay as compatible as possible to XPP3. The interface is used to either wrap StAX's XMLStreamReader if Smack is used on Java SE, and XPP3's XmlPullParser if Smack is used on on Android. Fixes SMACK-591. Also introduce JUnit 5 and non-strict javadoc projects.
This commit is contained in:
parent
b3646abecd
commit
4133eb175c
414 changed files with 3855 additions and 2041 deletions
|
|
@ -23,12 +23,11 @@ import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseExcept
|
|||
import org.jivesoftware.smack.parsing.SmackParsingException.SmackUriSyntaxParsingException;
|
||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||
import org.jivesoftware.smack.util.ParserUtils;
|
||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||
|
||||
import org.jivesoftware.smackx.geoloc.packet.GeoLocation;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
public class GeoLocationProvider extends ExtensionElementProvider<GeoLocation> {
|
||||
|
||||
@Override
|
||||
|
|
@ -38,9 +37,9 @@ public class GeoLocationProvider extends ExtensionElementProvider<GeoLocation> {
|
|||
GeoLocation.Builder builder = GeoLocation.builder();
|
||||
|
||||
outerloop: while (true) {
|
||||
int event = parser.next();
|
||||
XmlPullParser.Event event = parser.next();
|
||||
switch (event) {
|
||||
case XmlPullParser.START_TAG:
|
||||
case START_ELEMENT:
|
||||
String name = parser.getName();
|
||||
switch (name) {
|
||||
case "accuracy":
|
||||
|
|
@ -117,10 +116,14 @@ public class GeoLocationProvider extends ExtensionElementProvider<GeoLocation> {
|
|||
break;
|
||||
}
|
||||
break;
|
||||
case XmlPullParser.END_TAG:
|
||||
case END_ELEMENT:
|
||||
if (parser.getDepth() == initialDepth) {
|
||||
break outerloop;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// Catch all for incomplete switch (MissingCasesInEnumSwitch) statement.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue