Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
walladev #1
Member since Apr 2012 · 13 posts
Group memberships: Members
Show profile · Link to this post
Subject: How to convert string to Message Object in Matrix
Hi Alex,

I want to convert string to Message object in Matrix, for example

message string:

string msg = @"<message from="walla@server/vicent" to="walla@server/tom" id="1" type="chat" xmlns="jabber:client">
  <body>222</body>
</message> ";


Thanks
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
  1. string msgXml = @"<message from="walla@server/vicent" to="walla@server/tom" id="1" type="chat" xmlns="jabber:client">
  2.  <body>222</body>
  3. </message>";
  4. var msg = XmppXElement.LoadXml(msgXml) as Matrix.Xmpp.Client.Message;
Avatar
walladev #3
Member since Apr 2012 · 13 posts
Group memberships: Members
Show profile · Link to this post
Quote by Alex:
  1. string msgXml = @"<message from="walla@server/vicent" to="walla@server/tom" id="1" type="chat" xmlns="jabber:client">
  2.  <body>222</body>
  3. </message>";
  4. var msg = XmppXElement.LoadXml(msgXml) as Matrix.Xmpp.Client.Message;

Thanks Alex. I tried It works good
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: