powered by Jive Software

Smack PacketExtension

Hi all.

*I am extending majiic

messages using Smack

library, and I have got a doubt. Maybe,

you can help me.*

*I can perfectly add an

extension for a packet and recognize them (using

FilterListener class).*

*For example, the Presence

Message:*

Presence my_message = new Presence();

my_message.setTo();

PacketExtension my_extension = new PacketExtension(“x”, “http://my_page.es”);

my_message.addextension(my_extension);

SparkManager.getConnection().sendPacket();

*JID receive this message and is able to show the XML text of

this message:*

String xmlText = packet.toXML();

+"<presence

…>+

<x xmlns=“http://my_page.es”/>

</presence>"

*I am be able to add values (

<name>value</name>) to extension but we have got troubles with the

attributes.*

*how can we add attributes inside extension?. I mean, I

want to send this xml text after adding the extension:*

+"<presence

…>

<em

<x xmlns=“http://my_page.es”>

+<item name=“DIR”

version=“0.12”>+

</x>

</presence>"

and JID receives this xml text:

++"<presence …> <b

+++<x xmlns="urn:int:nato:majiic:xmpp:e

+++<it

++</x>

++</presence>"

*You can see

that JID is be able to recognize my extension and the +item+ label, but

the next text disappear: +name=“DIR”

version=“0.12”+. Only the label arrives.*

Can you help us?

Thanks you very much.