Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
bilalkhan #1
Member since Oct 2016 · 81 posts · Location: Pakistan
Group memberships: Members
Show profile · Link to this post
Subject: Read XML
  1.  
  2. <dialogueHistory id="R8zYh-18">
  3. <MessageID>43838</MessageID>
  4. <senderFullName>Idrees Ahmed</senderFullName>
  5. <recipientID>idrees@192.168.0.98</recipientID>
  6. <lastMsgSenderID>atif@192.168.0.98</lastMsgSenderID>
  7. <displayStatus>Developer</displayStatus>
  8. <ProfilePicURL>../res/Chat/images/larry.png</ProfilePicURL>
  9. <IsDelivered>true</IsDelivered>
  10. <IsRead>false</IsRead>
  11. <ChatDialogID>515</ChatDialogID>
  12. <messageText>F</messageText>
  13. <msgDate>12/21/2016 12:02:26 PM</msgDate>
  14. <unReadCount>0</unReadCount>
  15. <creationDate>12/19/2016 10:35:17 AM</creationDate>
  16. <type>1</type>
  17. <xmppRoomJid>app@conference.chatme.im</xmppRoomJid>
  18. <title>Group dialog title</title>
  19. <participant lastMessageStatus="1" role="1" affiliation="1" date="#DeliveryDate">hafeez@192.168.0.151</participant>
  20. <participant lastMessageStatus="2" role="1" affiliation="2" date="#ReadDate">atif@192.168.0.151</participant>
  21. <participant lastMessageStatus="1" role="2" affiliation="1" date="#DeliveryDate">bilal@192.168.0.151</participant>
  22. </dialogueHistory>
i want to read the the data of particpant tag

below is my code
  1. agsXMPP.Xml.Dom.ElementList chatDialoguesList = iq.Query.SelectElements("dialogueHistory");
  2.  
  3.  for (int i = 0; i < chatDialoguesList.Count; i++)
  4.                     {
  5.                         agsXMPP.Xml.Dom.Element element = chatDialoguesList.Item(i);
  6.                         chatDialogue.DialogueLastMessageId = Convert.ToInt32(element.GetTag("MessageID"));
  7.                        
  8.                         //how can i reaad the participant outter xml get tag give me the inner xml?
  9.  
  10.  
  11.  
  12.                      }
This post was edited on 2017-01-03, 09:58 by bilalkhan.
Avatar
bilalkhan #2
Member since Oct 2016 · 81 posts · Location: Pakistan
Group memberships: Members
Show profile · Link to this post
i have tried each dialogue contains many participants

in outer loop the element is traversing for each element--> particpants --> attributes

  1.                             agsXMPP.Xml.Dom.ElementList chatDialogueParticipantList = element.SelectElements("participant");
  2.  
  3.                             for (int j = 0; j < chatDialogueParticipantList.Count; j++)
  4.                             {
  5.                                 agsXMPP.Xml.Dom.Element participant = chatDialogueParticipantList.Item(i);
  6.                                 element.Attribute("lastMessageStatus");
  7.                                 element.Attribute("role");
  8.                                 element.Attribute("date");
  9.                                 element.Attribute("jid");
  10.  
  11.                             }

it will work?
This post was edited on 2017-01-03, 10:00 by bilalkhan.
Avatar
Alex #3
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Please format you code and question properly by using the code tags with csharp and xml.

See:
http://forum.ag-software.net/thread/893-code-formatting

Also your xml is not a complete stanza, only a fragment.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS