Java 类org.jivesoftware.smack.sm.packet.StreamManagement.Failed 实例源码

项目:Smack    文件:ParseStreamManagement.java   
public static Failed failed(XmlPullParser parser) throws XmlPullParserException, IOException {
    ParserUtils.assertAtStartTag(parser);
    String name;
    XMPPError.Condition condition = null;
    outerloop:
    while(true) {
        int event = parser.next();
        switch (event) {
        case XmlPullParser.START_TAG:
            name = parser.getName();
            String namespace = parser.getNamespace();
            if (XMPPError.NAMESPACE.equals(namespace)) {
                condition = XMPPError.Condition.fromString(name);
            }
            break;
        case XmlPullParser.END_TAG:
            name = parser.getName();
            if (Failed.ELEMENT.equals(name)) {
                break outerloop;
            }
            break;
        }
    }
    ParserUtils.assertAtEndTag(parser);
    return new Failed(condition);
}