This is the XML sent From XMPP Server Side that i want to recieve so that i can send it to my XML parser.
<message to="39@domainname.com/smack" chat_id="73392"
custom_packet="true" user_id="44" manager_id="39" time_stamp="0" website_id="0"
visitor_name="John" end_time="False" xml:lang="en-us" type="groupchat"
from="room73392@conference.domainname.com/39">
<body>Hello</body>
<x xmlns="http://jabber.org/protocol/muc#user">
<status xmlns="" code="0"/>
</x></message>
This Is a sample XML that i am Recieving. When i use p.toXML(); //Packet p
<message to="44@domainname.com/Smack"
from="room73407@conference.domainname.com/Visitor1171" type="groupchat">
<body>Hello</body>
<delay xmlns="urn:xmpp:delay"></delay>
<x xmlns="jabber:x:delay" stamp="20120917T05:57:19"
from="4732abb5@domainname.com/4732abb5">
</x></message>
I have Just started using XMPP server. So any Guidance Will be Appreciated.
You can't do this in Smack (and therefore aSmack) without modifying the source code. It will only parse a standard Message stanza, so all your custom attributes will be ignored. The proper approach in XMPP is to create extensions to the standard packets, not modify them. If you have control over what is being sent from the server, then you should change your approach to adding a custom extension to the message, thus changing this
to this
Then you can easily write your own provider to parse the custom packet extension and simply retrieve your custom object (created by your parser) by calling
You can check out the EmbeddedExtensionProvider to very easily write your provider.
You can read your attribues by adding the start tag for every case and then setting the value in bean Class.