use of org.jivesoftware.smackx.iot.element.NodeInfo in project Smack by igniterealtime.
the class IoTDisownProvider method parse.
@Override
public IoTDisown parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmppStringprepException {
Jid jid = ParserUtils.getJidAttribute(parser);
NodeInfo nodeInfo = NodeInfoParser.parse(parser);
return new IoTDisown(jid, nodeInfo);
}
use of org.jivesoftware.smackx.iot.element.NodeInfo in project Smack by igniterealtime.
the class IoTRegisterProvider method parse.
@Override
public IoTRegister parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
boolean selfOwned = ParserUtils.getBooleanAttribute(parser, "selfOwned", false);
NodeInfo nodeInfo = NodeInfoParser.parse(parser);
List<Tag> tags = new ArrayList<>();
while (parser.getDepth() != initialDepth) {
XmlPullParser.Event event = parser.next();
if (event != XmlPullParser.Event.START_ELEMENT) {
continue;
}
final String element = parser.getName();
Tag.Type type = null;
switch(element) {
case "str":
type = Tag.Type.str;
break;
case "num":
type = Tag.Type.num;
break;
}
if (type == null) {
continue;
}
String name = parser.getAttributeValue(null, "name");
String value = parser.getAttributeValue(null, "value");
tags.add(new Tag(name, type, value));
}
return new IoTRegister(tags, nodeInfo, selfOwned);
}
use of org.jivesoftware.smackx.iot.element.NodeInfo in project Smack by igniterealtime.
the class IoTClaimedProvider method parse.
@Override
public IoTClaimed parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmppStringprepException {
Jid jid = ParserUtils.getJidAttribute(parser);
NodeInfo nodeInfo = NodeInfoParser.parse(parser);
return new IoTClaimed(jid, nodeInfo);
}
use of org.jivesoftware.smackx.iot.element.NodeInfo in project Smack by igniterealtime.
the class IoTRemoveProvider method parse.
@Override
public IoTRemove parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws IOException {
Jid jid = ParserUtils.getJidAttribute(parser);
if (jid.hasResource()) {
// TODO: Should be SmackParseException.
throw new IOException("JID must be without resourcepart");
}
BareJid bareJid = jid.asBareJid();
NodeInfo nodeInfo = NodeInfoParser.parse(parser);
return new IoTRemove(bareJid, nodeInfo);
}
Aggregations