powered by Jive Software

Smack and xhtml messages

Hi to all, I apologize for mistakes or silly questions but I’'m a Smack+Jabber newbie.

I’'m trying to send an xhtml message within a Java (rel. 1.5.0_06) application using Smack (rel. 3.0.2) to a Spark client (rel. 2.5.2) through a OpenFire server (rel. 3.3.1).

OpenFire and Spark are on the same windows box and the Java client is on another windows box; both are on the same subnet.

The Java client sends the message, the Spark client receives the message but doesn’'t visualize it; I say that it receives the message because in the “show traffic window” is listed the received message with the following body:



The Java client code is:

package com.ti.lab.qos.test.jabber;

import org.jivesoftware.smack.*;

import org.jivesoftware.smack.packet.Message;

import org.jivesoftware.smack.Chat;

import org.jivesoftware.smackx.XHTMLManager;

import org.jivesoftware.smackx.XHTMLText;

public class SimpleClient {

public void simpleClient() {};


  • @param args


public static void main(String[] args) {

// TODO Auto-generated method stub

String msg = “test message”;

SimpleClient sc = new SimpleClient();



public void sendMsg(String msg){

XMPPConnection conn1;

try {

XMPPConnection.DEBUG_ENABLED = true;

// Create a connection to the jabber.org server on a specific port.

conn1 = new XMPPConnection(new ConnectionConfiguration(“”, 5222));


// Login as a user

conn1.login(“QoSServiceAdmin”, “QoSServiceAdmin”);

// Create a chat for sending/receiving messages

ChatManager newChatMan = conn1.getChatManager();

Chat newChat = newChatMan.createChat("user1@", new MyMessageListener());

Message message = new Message();

message.setSubject(“QoS Service notify”);

//message.setBody(“Would you like to see the requested content with QoS ?”);

// Create an XHTMLText to send with the message

XHTMLText xhtmlText = new XHTMLText(null, null);


xhtmlText.append("Hey user1, this is my new ");








// Add the XHTML text to the message

XHTMLManager.addBody(message, xhtmlText.toString());


for(long i=1; i<900000000; i++){}


} catch (XMPPException e) {

// TODO Auto-generated catch block





Any suggestion?

Thank you


Sorry but the xhtml tags of the message reported in the traffic window of Spark have disappeared in this thread, but actually they have been received by Spark…

Spark doesn’'t support XHTML messages yet. Make sure to vote for this feature

Oops, due to the fact that it rendered a url as a clickable link trapped me.

Apologies for the silly question.