Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
js629AC #1
Member since Oct 2013 · 4 posts
Group memberships: Members
Show profile · Link to this post
Subject: Convert XML to Message
I was wondering how I would go about converting some XML to a message?
Avatar
Alex #2
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
see: http://forum.ag-software.net/thread/842-Send-Test-XML-Mess…
Avatar
js629AC #3
Member since Oct 2013 · 4 posts
Group memberships: Members
Show profile · Link to this post
Thanks for the quick response Alex, but can you expand on this 'You can use the LoadXml member of Element which parses and loads the Xml.' a little bit?

I can't seem to find element.loadxml.
Avatar
js629AC #4
Member since Oct 2013 · 4 posts
Group memberships: Members
Show profile · Link to this post
            agsXMPP.Xml.Dom.Document d = new agsXMPP.Xml.Dom.Document();
            d.LoadXml(message);
            Message msg = new Message();
            msg = d as Message();


What am I doing wrong here?
Avatar
Alex #5
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
try:

  1. string xml = "<message xmlns='jabber:client'><body>Hello World</body></message>";
  2. var msg = Element.LoadXml(xml) as Message;
Avatar
js629AC #6
Member since Oct 2013 · 4 posts
Group memberships: Members
Show profile · Link to this post
This is what I found to work last night:

  1. agsXMPP.Xml.Dom.Document d = new agsXMPP.Xml.Dom.Document();
  2. d.LoadXml(decryptedmessage);
  3. var msg = d.RootElement as agsXMPP.protocol.client.Message;

Thanks for your help Alex.
This post was edited 2 times, last on 2013-10-09, 16:45 by Alex.
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