blob: 7eacfc944e211843a9f89b2a9ad618eab50c25fc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
package com.juick.server.xmpp.router;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
/**
* Created by vitalyster on 03.02.2017.
*/
public class StreamError {
private String condition;
public StreamError() {}
public StreamError(String condition) {
this.condition = condition;
}
public static StreamError parse(XmlPullParser parser) throws IOException, XmlPullParserException {
StreamError streamError = new StreamError();
while (parser.next() == XmlPullParser.START_TAG) {
final String tag = parser.getName();
final String xmlns = parser.getNamespace();
if (xmlns.equals(StreamNamespaces.NS_XMPP_STREAMS)) {
streamError.condition = tag;
} else {
XmlUtils.skip(parser);
}
}
return streamError;
}
public String getCondition() {
return condition;
}
@Override
public String toString() {
return String.format("<stream:error><%s xmlns='%s'/></stream:error>", condition, StreamNamespaces.NS_XMPP_STREAMS);
}
}
|