[jdev] Application-specific payload in messages

Matthias Wimmer m at tthias.eu
Sun Mar 25 17:30:57 CDT 2007


Hi!

hyperstruct - jdev schrieb:
> <message to="app at server.org">
>  <x xmlns="http://bar.org/protocol">
>    <foo/>
>  </x>
> </message>
> 
> <message to="app at server.org">
>  <foo xmlns="http://bar.org/protocol"/>
> </message>

Both is valid (in case the http://bar.org/protocol namespace knows an
<x/> element).

The first has been used in older protocols, as in the beginning of
Jabber it has been thought that the element containing an extension must
have the local name "x". This was because we did not do namespaces right
at the beginning.

But as the element having the xmlns declaration is already in the new
namespace, this was wrong. (As all these x elements are not part of the
Jabber namespace anyway.)

If you define your own namespace, you may define an "x" element in this
namespace. But in general or if you are using data in an existing
namespace, this namespace normally will not have an x element, so you
even have to use the later form.

So my suggestion would be to always use the later form for new extensions.


Matthias

-- 
Matthias Wimmer      Fon +49-700 77 00 77 70
Züricher Str. 243    Fax +49-89 95 89 91 56
81476 München        http://ma.tthias.eu/




More information about the JDev mailing list