[standards-jig] Namespaces

Mike Lin mikelin at MIT.EDU
Wed Aug 7 00:20:15 UTC 2002

Rob brings up a good, open question about whether C2S and S2C streams
should match, but the really interesting question is what to do for
C2S2C packet delivery when there are arbitrary namespaces declared on
both ends.

For example, take S2C stream A:
<stream:stream xmlns:stream="http://etherx.jabber.org/streams"

And C2S stream B:
<s:stream xmlns:s="http://etherx.jabber.org/streams"
 <c:message id="1" to="A">

What the server has to do in order to correctly deliver message 1 over
stream A is "very nontrivial". It requires the server to walk the whole
XML tree of each packet, rewrite certain prefixes, and add declarations
for other prefixes that it detects are not declared internally to the

I've implemented the algorithm to do this twice now, in Scheme and
OCaml. In fact, the OCaml XMPP library that I'm going to release Real
Soon Now lets you specify namespace associations by URI, while the
library handles emitting the correct prefixes. The goals that it has to
achieve are straightforward, but the details of actually doing it are
intricate and very easy to screw up. Is It Worth It?

I have to say it's my opinion that we should leave Jabber the way it is
and just dump the whole "streaming document" paradigm in JNG, so that
each packet is a self-contained document. Like using XML structure for
framing, the "streaming document" looks nice on paper, but I think it's
just not worth it because it's too hard to do right. Anyway, I know this
is an unpopular position, so I won't push it further (for now).


On Tue, 2002-08-06 at 19:46, Robert Norris wrote:
> > These points are all just a starting point for this process, but I 
> > believe that we _must_ pursue full namespace compliance in the near 
> > future.
> As a couple of people have noted, I've done some work on getting
> full namespace support into 1.5.
> However, I think some clarifications need to be made:
> 1) When people full namespace compliance, what do they mean exactly? My
>    understanding (and the answer I got when I posed the question to
>    jdev) is that this simply means support for arbitrary prefixes. Is
>    this correct?
> 2) Since a normal connection has two XML streams, and thus, two XML
>    documents, are the namespace prefixes required to be the same for
>    both streams? ie, is this valid?
> C: <foo:stream
>                xmlns:foo='http://etherx.jabber.org/streams'
>                xmlns:bar='jabber:client'
>                xmlns:baz='jabber:iq:auth'
>                to='cataclysm.cx'>
> S: <stream:stream
>                   xmlns:stream='http://etherx.jabber.org/streams'
>                   xmlns='jabber:client'
>                   id='12345678'>
> C: <bar:iq type='set' id='a1'>
>      <baz:query>
>        <baz:username>rob</baz:username>
>        <baz:resource>laptop</baz:resource>
>        <baz:password>secret</baz:password>
>      </baz:query>
>    </bar:iq>
> S: <iq type='result' id='a1'/>
> IMO, this should be allowed. Full namespace support requires some
> fundamental changes to the way a XML streams implementation works, and I
> know from my work on 1.5 that this is much easier to implement than
> keeping prefixes the same would be.
> There should be a JEP on this, to outline exactly what the requirements
> are.
> Rob.
> -- 
> Robert Norris                                       GPG: 1024D/FC18E6C2
> Email+Jabber: rob at cataclysm.cx                Web: http://cataclysm.cx/

More information about the Standards mailing list