Lets take as an example the official XEP page (http://xmpp.org/extensions/xep-0045.html) with the response:
<iq from='chat.shakespeare.lit'
id='zb8q41f4'
to='hag66@shakespeare.lit/pda'
type='result'>
<query xmlns='http://jabber.org/protocol/disco#items'>
<item jid='heath@chat.shakespeare.lit'
name='A Lonely Heath'/>
<item jid='coven@chat.shakespeare.lit'
name='A Dark Cave'/>
<item jid='forres@chat.shakespeare.lit'
name='The Palace'/>
<item jid='inverness@chat.shakespeare.lit'
name='Macbeth's Castle'/>
</query>
</iq>
You can obtain the query
element by doing:
NSXMLElement *queryElement = [iq elementForName:@"query" xmlns:@"http://jabber.org/protocol/disco#items"];
Then you can iterate over the items:
NSArray *items = [queryElement elementsForName:@"item"];
for (NSXMLElement *i in items) {
NSString *roomName = [i attributeStringValueForName:@"name"];
NSString *jidString = [i attributeStringValueForName:@"jid"];
XMPPJID *jid = [XMPPJID jidWithString:jidString];
}