Sending XHTML messages with &,>,< and " characters


Using Smack 2.2.1 and Wildfire 3.1.0 beta 2, I am trying to use XHTMLManager to send and receive messages with &,>,< and " characters. I construct the message, encoding any occurences of these characters with the appropriate entity such a & for & etc.

On the receiving end I then wish the parse the message using SAXParser in order to display it with the correct styles. This is where is breaks. XHTMLManager.getBodies() returns bodies that have already been decoded, breaking SAXParser. For example, I send the following message …

cat & mouse

I receive the message and use XHTMLManager.getBodies() and get the following …

cat & mouse

This is going to choke most XML parsers. The only way I have found to get around this is by double encoding all messages on the way out. I.e.

cat & mouse

This just doesn’'t seem right. What is the correct way to send these characters in XHTML messages? Using Smack 2.2.1 and Wildfire 3.1.0 beta 2.


Think I submitted a patch about two months ago that fixes this bug. It will be part of Smack 3.0.

Proper handling of XHTML message extensions is impossible in Smack 2.2.1.

Heh. Ok, thanks. Is it worth getting a nightly build and trying that?

Just tried the latest nightly build of Smack and after converting to the new API all seems well :-). Thanks for the help.