powered by Jive Software

Can you insert an XML text extension directly into message packet?

Hi,

For an outgoing message, I have a string containing the xml I need to send in the message. Is there a way I can insert it directly into the message as text?

I don’t want to go through the trouble of setting up parsing to get it into a PacketExtension just to have it converted back into text for the outgoing packet.

Thanks!

-Mike

My current approach: new class inherits from Message and overrides toXML() to just send out a text string. So, from the muc, I create a message and use toXML() to get its string. I insert my extension before the . Then I create an instance of my XMLTextMessage class, and set its string to the new xml string including the extension. Then I send that packet off.

It’s almost coded up…

Anyone have any thoughts on this approach?

Well, using apache commons lib i escape the xml as string so that it converts all the open/close tags into html for example it converts < into < and so on.

in the IQHandler i reconvert the string to get the xml back.

it that what you are looking for ? hope that it will help !