I want to operate with XMPP users with github.com/mattn/go-xmpp
Golang package. I change a little official example and got something like this:
switch v := chat.(type) {
case xmpp.IQ:
if len(v.Query) != 0 {
fmt.Printf("Query: %s", v.Query)
}
default:
fmt.Printf("detect default type: %T
", v)
}
v.Query
is a XML document with namespace like
<query xmlns="jabber:iq:roster">
<item jid="JID1" name="Name" subscription="none" ask="subscribe">
<group></group>
</item>
<item jid="JID2" name="Another name" subscription="both">
<group>Group</group>
</item>
<item jid="JID3" name="Eman" subscription="both">
<group>AnotherGroup</group>
</item>
</query>
How can I parse this document and iterate over jid
elements?