mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-17 00:11:07 +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
|
|
@ -22,12 +22,11 @@ import java.util.Date;
|
|||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException;
|
||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||
|
||||
import org.jivesoftware.smackx.delay.packet.DelayInformation;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
public abstract class AbstractDelayInformationProvider extends ExtensionElementProvider<DelayInformation> {
|
||||
|
||||
@Override
|
||||
|
|
@ -36,23 +35,19 @@ public abstract class AbstractDelayInformationProvider extends ExtensionElementP
|
|||
IOException, SmackTextParseException {
|
||||
String stampString = (parser.getAttributeValue("", "stamp"));
|
||||
String from = parser.getAttributeValue("", "from");
|
||||
String reason = null;
|
||||
if (!parser.isEmptyElementTag()) {
|
||||
int event = parser.next();
|
||||
switch (event) {
|
||||
case XmlPullParser.TEXT:
|
||||
reason = parser.getText();
|
||||
parser.next();
|
||||
break;
|
||||
case XmlPullParser.END_TAG:
|
||||
reason = "";
|
||||
break;
|
||||
default:
|
||||
// TODO: Should be SmackParseException.
|
||||
throw new IOException("Unexpected event: " + event);
|
||||
}
|
||||
} else {
|
||||
final String reason;
|
||||
XmlPullParser.Event event = parser.next();
|
||||
switch (event) {
|
||||
case TEXT_CHARACTERS:
|
||||
reason = parser.getText();
|
||||
parser.next();
|
||||
break;
|
||||
case END_ELEMENT:
|
||||
reason = null;
|
||||
break;
|
||||
default:
|
||||
// TODO: Should be SmackParseException.
|
||||
throw new IOException("Unexpected event: " + event);
|
||||
}
|
||||
|
||||
Date stamp = parseDate(stampString);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue