[jdev] XHTML-IM XEP implementation

Tomasz Sterna tomek at xiaoka.com
Fri Dec 15 09:29:26 CST 2006


I am wondering, whether we didn't shoot our foot with this spec.
I'm implementing it now, and it's a real PITA.
It's clear for me now, why many clients implemented reading XHTML-IM
messages, but not writing them.

To display it, you just put an HTML-enabled text control from your GUI
toolkit on a chatwindow (which you most probably did, to beautify it),
append XHTML part of the message instead of plaintext and you're done.

But creating this XHTML part... It's a different story.
User is entering some text in a textbox, putting some formatting
attributes here and there, toolkit gives you a string with attributes
inside, and you have to deal with it.
Ok. I'm slicing the text and while tracking the attributes wrapping it
in <span>s. Bandwitch is hurting, because message triples (or more) its
size. Then when it "works" you realize, that all user linebreaks needs
to be converted to <br/>. Ok. Handled that also.
All URLs are unclickable, because other side client is not parsing XHTML
part, only plaintext one.
And last, but not least... HTML is squashing whitespace. So.. Bye bye
indentation. All pasted code, tables etc. ends up completely unreadable.

This is where I gave up...

Tomasz Sterna
Xiaoka Grp.  http://www.xiaoka.com/

More information about the JDev mailing list