[JDEV] client to client communication using jabber?
Tijl Houtbeckers
thoutbeckers at splendo.com
Sat Jan 4 14:08:36 CST 2003
"Dan" <vze2ry7c at verizon.net> wrote on 4-1-2003 20:44:25:
>
>Tijl,
>
>I don't know where to get the actual DTD but here is the documentation
>I can find on the message element.
>
>"A message chunk MAY contain zero or one of each of the following child
>elements (which may not contain mixed content):
>body - The textual contents of the message; normally included but not
>required. The <body/> element MUST NOT have any attributes."
>
>Stuffing xml into the body tag doesn't seem to violate this. I do
>have to escape the tags stuffed into the <body> element.
I was right in my assumption then that you're not really sending XML.
Ofcourse you're allowed to do this. But it's not so much taking
advantage of Jabber's ability to send XML along with messages.
>The reason I want to do this is simple though perhaps not sufficient to
>justify abusing the tag in this way. My client has a lot of
>functionality specific to managing data about items that are bought
>and sold. I would like to be able to send that data to anyone with a
>Jabber client. Stuffing the data in the body tag ensures that they can
>get the information whereas using a separate namespace might cause the
>data to be missed. Anyone who receives such a message would be able
>to understand the contents and decide what to do with it.
Well, I don't think that if I show my grandmother some bits of XML she
understand what it means. XML allows for (more) easy debugging and
reverse enginering but I wouldn't quite call it human readable.
>
>I may be stating heresy here but I think one of the greatest values of
>XML is that it is that you can look at it and know what it means as
>opposed to, say, looking at an EDI document..
If I were you I'd send along the XML *outside* of the body tag, and a
*real* human readable represenation of the data in the body element.
Clients that understand the XML can use that. This is the proper way of
doing things in Jabber. Even if you don't want to make a more textual
representation, send both the escaped XML in the body, and the real
proper XML outside the body and use that last one for your client.
Because if another developer will want to implement your features in
another client he is not going to "fish" your XML out of a body tag..
all libraries etc. don't do this either.
--
Tijl Houtbeckers
Java/J2ME/GPRS Software Engineer @ Splendo
The Netherlands
More information about the JDev
mailing list