Subject: Questions about IqEventData
What is the best way to access the affiliations inside of the Iq object? When retrieving subscriptions back I have been doing the following which is great:
and then iterating through the Subscriptions.
I had hoped that the affiliations would be the same way, unfortunately I am doing something wrong and was wondering if someone could point me in the right direction. I'm assuming there is a standard way of retrieving the data from an IqEventArgs apart from actually parsing the xml but I could be wrong.
This returns an affiliations XElement but when I attempt to drill down further to the affiliation element it always returns null... It shows up in the debugger so I know its there but for some reason I'm unable to retrieve.
Thanks in advance,
Peter Norman
- var pubsub = e.Iq.Element<PubSub>();
and then iterating through the Subscriptions.
I had hoped that the affiliations would be the same way, unfortunately I am doing something wrong and was wondering if someone could point me in the right direction. I'm assuming there is a standard way of retrieving the data from an IqEventArgs apart from actually parsing the xml but I could be wrong.
- private void OnRequestAffiliation(object sender, IqEventArgs e)
- {
- var iq = e.Iq;
- if(iq != null)
- {
- XNamespace ns = "http://jabber.org/protocol/pubsub#owner";
- var a = iq.Query.Element(ns + "affiliations");
- }
- }
This returns an affiliations XElement but when I attempt to drill down further to the affiliation element it always returns null... It shows up in the debugger so I know its there but for some reason I'm unable to retrieve.
Thanks in advance,
Peter Norman
This post was edited on 2013-03-14, 20:25 by Alex.