Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
mikemck #1
User title: XMPP Beginner
Member since Mar 2009 · 7 posts · Location: Hongkong
Group memberships: Members
Show profile · Link to this post
Subject: How to make a struture of XML
Hello, Please give me a advise how to make a structure of the following XML. Thank you very much.

<message type="MonitorRequest" from="username" to="username1">
<body>
<count>1</count>
<typeno>03094940</typeno>
</body>
</message>
<message type="MonitorRequest" from="username" to="username1">
<body>
<count>2</count>
<typeno>03094940</typeno>
<typeno>87434430</typeno>
</body>
</message>
<message type="MonitorRequest" from="username" to="username1">
<body>
<count>5</count>
<typeno>03094940</typeno>
<typeno>87434430</typeno>
<typeno>53094535</typeno>
<typeno>53853478</typeno>
<typeno>45445434</typeno>
</body>
</message>

Michael
Avatar
Alex #2
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Here is a tutorial for creating custom packets/objects with agsXMPP:
http://www.ag-software.net/download/xmpp/creating_own_pack…

You can't have a type of MonitorRequest on messages. Only the predefined types of normal, chat, headline, groupchat and error are allowed.
I suggest to add your own namespace under message with your custom packets.

Alex
Avatar
mikemck #3
User title: XMPP Beginner
Member since Mar 2009 · 7 posts · Location: Hongkong
Group memberships: Members
Show profile · Link to this post
Alex,

is that mean I need to add a new cs to do this message type in my project?  or add this message type to the protocol.client.message.cs in the library?
Thank you for your help.

Michael
Avatar
Alex #4
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
  • you have to derive you custom element class from agsXMPP.Xml.Dom.Element
  • You have to register it in the ElementFactory
  • this is all described in the example posted above
  • You are not allowed to add new message types, this will cause problems with existing XMPP compliant servers.
Avatar
mikemck #5
User title: XMPP Beginner
Member since Mar 2009 · 7 posts · Location: Hongkong
Group memberships: Members
Show profile · Link to this post
sorry Alex,

If I want to read this format of message, do I need to create this packets structure first?
If no need to create the packets structure, then please tell me how to read the XML format message. please give me a simple.

Many thanks!!!

Michael
Avatar
Alex #6
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by mikemck:
If I want to read this format of message, do I need to create this packets structure first?

you don't have to. You can also use the Xml functions of the message class to parse your xml. Or put the content in a .NEt XmlDocument. Bu its better code if you create the packet classes.

Quote by mikemck:
If no need to create the packets structure, then please tell me how to read the XML format message. please give me a simple.

Please study the custom packet example which I suggested before. There is all you need.

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