1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-23 02:58:00 +01:00

Small tweaks.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@6184 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Alex Wenckus 2006-11-20 23:18:14 +00:00 committed by alex
parent 1f3ab16aad
commit 18a35e4e8f

View file

@ -43,16 +43,15 @@ public class DiscoverItemsProvider implements IQProvider {
discoverItems.setNode(parser.getAttributeValue("", "node")); discoverItems.setNode(parser.getAttributeValue("", "node"));
while (!done) { while (!done) {
int eventType = parser.next(); int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG) {
if ("item".equals(parser.getName())) { if (eventType == XmlPullParser.START_TAG && "item".equals(parser.getName())) {
// Initialize the variables from the parsed XML // Initialize the variables from the parsed XML
jid = parser.getAttributeValue("", "jid"); jid = parser.getAttributeValue("", "jid");
name = parser.getAttributeValue("", "name"); name = parser.getAttributeValue("", "name");
node = parser.getAttributeValue("", "node"); node = parser.getAttributeValue("", "node");
action = parser.getAttributeValue("", "action"); action = parser.getAttributeValue("", "action");
} }
} else if (eventType == XmlPullParser.END_TAG) { else if (eventType == XmlPullParser.END_TAG && "item".equals(parser.getName())) {
if ("item".equals(parser.getName())) {
// Create a new Item and add it to DiscoverItems. // Create a new Item and add it to DiscoverItems.
item = new DiscoverItems.Item(jid); item = new DiscoverItems.Item(jid);
item.setName(name); item.setName(name);
@ -60,11 +59,10 @@ public class DiscoverItemsProvider implements IQProvider {
item.setAction(action); item.setAction(action);
discoverItems.addItem(item); discoverItems.addItem(item);
} }
if ("query".equals(parser.getName())) { else if (eventType == XmlPullParser.END_TAG && "query".equals(parser.getName())) {
done = true; done = true;
} }
} }
}
return discoverItems; return discoverItems;
} }