[JDEV] client to client communication using jabber?
Pat Magnan
pat at sluggo.org
Sat Jan 4 20:36:41 CST 2003
I'm with this latter camp, as suggested here, I do it just like that..
The body in my case just says 'you aren't using my program, else you
wouldn't get this message'. However, that's not required in your case.
All my application specific XML is outside the body kinda like:
<message to='' from='' type='mycustommessage|chat|whatever'>
<body>normal body stuff/ text representation of your data.</body>
<subject>whatever</subject>
<mydata xmlns="my:custom:namespace">
<myxml>
more data
</myxml>
</mydata>
</message>
In your case, use messges that normal clients will interpret normally
(not see a bunch of XML tags) in the body, and put the 'special' stuff
outside. I'm working with JabberCOM, and can't quite work out how to
correctly use the IXMLTagIterator stuff (maybe because my XML is poorly
formed from its perspective), however, I just grab the raw XML in a
CString, find the tag I want, and it's data, and use that (just using
'Find'). Works great, and the embedded chat client 'skips' the special
messages so users don't see this 'internal' data. In fact, you'd see
nothing weird with Exodus or whatever arbitrary client.
In JabberCOM anyway, the message and the XML tags are available
seperately (well kinda).
Tijl Houtbeckers wrote:
>
>
> 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.
>
>
More information about the JDev
mailing list