Project

General

Profile

XML, XMPP and XMLNS

Avatar?id=6023&size=32x32

Artur Hefczyc TigaseTeam
Added over 4 years ago

Jabber/XMPP protocol is based on data stream embedded in XML. Single XMPP connection is like a single XML document. XML is essential for XMPP and all its services are built on top of it.

Whole XML stream is generated, sent, received and parsed by Jabber applications and human usually don't see any markup. Thus usually XML stream processing is limited to what applications might expect in this stream. Usually there are no XML comments in stream, no processing instructions. All the XML data usually forms correct XML document and because of dynamic nature of XMPP stream applications don't validate stream against XML Schema or DTD.

It does make sense to use kind of simplified XML parsers which can process only limited set of XML features. It is especially important for server side processing where performance of any operation may impact overall server throughput.

How far this simplification can go?

<!--break-->

Well, even if some XML elements don't normally occur like XML comments they may happen to be sent in the steam. Since they are not forbidden in XML nor they are in XMPP applications should handle them somehow at least by ignoring them. They don't carry any useful information for application anyway so there is no lost.

There is however one important XML feature heavily used by Jabber/XMPP protocol which seems somehow neglected by XML parsers or at least Jabber applications.

XML Namespaces are used from the stream definition to almost any stanza sent over the XMPP stream. Any extension (XEP) is defined within own namespace. s2s dialback protocol is defined in separate namespace too - 'jabber:server:dialback'. It looks like XML namespaces are as vital to protocol as XML is itself but are they handled properly by Jabber/XMPP applications?

I wonder how many XMPP applications (client side or server side) would properly recognize all 3 correct forms of vCard element:

<vCard xmlns="vcard-temp"/>
<temp:vCard xmlns:temp="vcard-temp"/>
<foo:vCard xmlns:foo="vcard-temp"/>

Even though I don't know answer for this question at least I know that most s2s implementations don't really care about 'jabber:server:dialback' namespace. They just expect element names: db:result or db:valid. In most cases you can not establish s2s connection if you send:
<result xmlns='jabber:server:dialback'
to='Receiving Server'
from='Originating Server'>98AF014EDC0...</result>
instead of:
<db:result
to='Receiving Server'
from='Originating Server'>98AF014EDC0...</db:result>
element.

When I login to my Jabber account the server connects to approx 25 other servers to notify buddies from my roster about my presence. When I enabled full XMLNS support in Tigase server I could connect only GoogleTalk Jabber service only.

Now Tigase works with full namespaces support for all incoming traffic and with kind of simplified support for outgoing traffic just to make sure it can establish s2s connection with all other servers.

It seems to me that XMLNS is so important part of XML we use that we should not neglect them. Correct me if I am wrong, my thoughts are based on Namespaces in XML 1.0.