XEP-0044: Full Namespace Support for XML Streams

Abstract:A description of the use of namespaces within Jabber.
Author:Robert Norris
Copyright:© 1999 - 2014 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status:Deferred
Type:Standards Track
Version:0.1
Last Updated:2002-08-26

WARNING: Consideration of this document has been Deferred by the XMPP Standards Foundation. Implementation of the protocol described herein is not recommended.


Table of Contents


1. Introduction
2. Requirements and Protocol
3. Implementation Notes

Appendices
    A: Document Information
    B: Author Information
    C: Legal Notices
    D: Relation to XMPP
    E: Discussion Venue
    F: Requirements Conformance
    G: Notes
    H: Revision History


1. Introduction

Jabber has traditionally supported a subset of the XML Namespaces specification [1]. The protocol has been restricted to using specific namespace prefixes.

This is convenient for client and server implementors, since they only need to check the element name to determine both the name and the context of the element. However, these restrictions mean that developers are unable to take advantage of some of the features that namespaces provide.

Many developers have expressed an interest in having Jabber fully support namespaces - a desire which is likely to increase as time goes on. This support consists of allowing any namespace prefix to be used with any namespace, and also to allow namespace prefixes to be pre-declared on the stream root.

This document outlines the semantics required for servers and clients to support namespaces fully, and also discusses implementation techniques and methods for providing compatibility with older "fixed-prefix" implementations.

2. Requirements and Protocol

A typical XML stream is a pair of XML documents, one for each direction of communication between the two peers. An simple example of these might look like this:

Example 1. A typical XML stream

SEND: <stream:stream xmlns='jabber:client'
                     xmlns:stream='http://etherx.jabber.org/streams'
                     to='jabber.org'>
RECV: <stream:stream xmlns='jabber:client'
                     xmlns:stream='http://etherx.jabber.org/streams'
                     id='12345678'>
SEND: <iq type='get' to='jabber.org'>
        <query xmlns='jabber:iq:version'/>
      </iq>
RECV: <iq type='result' from='jabber.org'>
        <query xmlns='jabber:iq:version'>
          <name>jsm</name>
          <version>1.4.2</version>
          <os>Linux 2.4.19</os>
        </query>
      </iq>
   

Note that there may also be additional namespaces specified in the stream header, to select or inform of various server features:

Example 2. A typical XML stream with stream options

SEND: <stream:stream xmlns='jabber:client'
                     xmlns:stream='http://etherx.jabber.org/streams'
                     xmlns:sasl='http://www.iana.org/assignments/sasl-mechanisms'
                     to='jabber.org'>
RECV: <stream:stream xmlns='jabber:client'
                     xmlns:stream='http://etherx.jabber.org/streams'
                     xmlns:sasl='http://www.iana.org/assignments/sasl-mechanisms'
                     id='12345678'>
      <sasl:mechanisms>
        <sasl:mechanism>PLAIN</sasl:mechanism>
        <sasl:mechanism>DIGEST-MD5</sasl:mechanism>
        <sasl:mechanism>EXTERNAL</sasl:mechanism>
      </sasl:mechanisms>
SEND: <iq type='get' to='jabber.org'>
        <query xmlns='jabber:iq:version'/>
      </iq>
RECV: <iq type='result' from='jabber.org'>
        <query xmlns='jabber:iq:version'>
          <name>jsm</name>
          <version>1.4.2</version>
          <os>Linux 2.4.19</os>
        </query>
      </iq>
  

Currently, the prefix for each namespace is fixed; it cannot vary at all, since implementations use it for matching. The desire is to be able to use arbitrary prefixes:

Example 3. XML stream with arbitrary namespace prefixes (1)

SEND: <stream xmlns:app='jabber:client'
              xmlns='http://etherx.jabber.org/streams'
              to='jabber.org'>
RECV: <stream xmlns:app='jabber:client'
              xmlns='http://etherx.jabber.org/streams'
              id='12345678'>
SEND: <app:iq type='get' to='jabber.org'>
        <query xmlns='jabber:iq:version'/>
      </app:iq>
RECV: <app:iq type='result' from='jabber.org'>
        <query xmlns='jabber:iq:version'>
          <name>jsm</name>
          <version>1.4.2</version>
          <os>Linux 2.4.19</os>
        </query>
      </app:iq>
  

Also, since there exist streams in both directions, it should be possible for prefixes to differ between the two streams:

Example 4. XML stream with arbitrary namespace prefixes

SEND: <stream xmlns:app='jabber:client'
              xmlns='http://etherx.jabber.org/streams'
              to='jabber.org'>
RECV: <stream:stream xmlns='jabber:client'
                     xmlns:stream='http://etherx.jabber.org/streams'
                     id='12345678'>
SEND: <app:iq type='get' to='jabber.org'>
        <query xmlns='jabber:iq:version'/>
      </app:iq>
RECV: <iq type='result' from='jabber.org'>
        <ver:query xmlns:ver='jabber:iq:version'>
          <ver:name>jsm</ver:name>
          <ver:version>1.4.2</ver:version>
          <ver:os>Linux 2.4.19</ver:os>
        </ver:query>
      </iq>
  

Additionally, it should be possible to declare namespaces on the stream header so that they don't need to be declared later:

Example 5. XML stream with namespaces declared in the stream header

SEND: <stream:stream xmlns='jabber:client'
                     xmlns:stream='http://etherx.jabber.org/streams'
                     xmlns:ver='jabber:iq:version'
                     to='jabber.org'>
RECV: <stream:stream xmlns='jabber:client'
                     xmlns:stream='http://etherx.jabber.org/streams'
                     xmlns:ver='jabber:iq:version'
                     id='12345678'>
SEND: <iq type='get' to='jabber.org'>
        <ver:query/>
      </iq>
RECV: <iq type='result' from='jabber.org'>
        <ver:query>
          <ver:name>jsm</ver:name>
          <ver:version>1.4.2</ver:version>
          <ver:os>Linux 2.4.19</ver:os>
        </ver:query>
      </iq>
  

And of course, any combinations of these should be valid, as long as they conform to the XML Namespaces specification.

3. Implementation Notes

In order to implement namespaces correctly, implementations will need to check both the namespace of an element (or attribute), and its namespace, in order to match it. An implementation will need to maintain some sort of mapping between prefixes and namespaces, though some parsers, such as recent versions of Expat, can do this for the implementor.

Implementations should, wherever possible, adhere to the IETF maxim "be liberal in what you accept, and conservative in what you send". This means accepting any valid namespace prefix, but using only the traditional prefixes (i.e. "stream" for "http://etherx.jabber.org/streams", "sasl" for "http://www.iana.org/assignments/sasl-mechanisms", and no prefix for the application namespace). For servers, this has the added benefit of getting compatibility with non-namespace-aware clients for free.

In server components that may have to forward packets received from one stream to another stream, it may be necessary for the application namespace to be rewritten before the packet is forwarded. Examples of this are client-to-server and server-to-server components, which must convert "jabber:client" and "jabber:server" components, respectively, into "jabber:component:accept" packets before they are forwarded to the router.


Appendices


Appendix A: Document Information

Series: XEP
Number: 0044
Publisher: XMPP Standards Foundation
Status: Deferred
Type: Standards Track
Version: 0.1
Last Updated: 2002-08-26
Approving Body: XMPP Council
Dependencies: None
Supersedes: None
Superseded By: None
Short Name:
Source Control: HTML
This document in other formats: XML  PDF


Appendix B: Author Information

Robert Norris

Email: rob@cataclysm.cx
JabberID: rob@cataclysm.cx


Appendix C: Legal Notices

Copyright

This XMPP Extension Protocol is copyright © 1999 - 2014 by the XMPP Standards Foundation (XSF).

Permissions

Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.

Disclaimer of Warranty

## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##

Limitation of Liability

In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.

IPR Conformance

This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at <http://xmpp.org/about-xmpp/xsf/xsf-ipr-policy/> or obtained by writing to XMPP Standards Foundation, 1899 Wynkoop Street, Suite 600, Denver, CO 80202 USA).

Appendix D: Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 6120) and XMPP IM (RFC 6121) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.


Appendix E: Discussion Venue

The primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.

Discussion on other xmpp.org discussion lists might also be appropriate; see <http://xmpp.org/about/discuss.shtml> for a complete list.

Errata can be sent to <editor@xmpp.org>.


Appendix F: Requirements Conformance

The following requirements keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".


Appendix G: Notes

1. http://www.w3.org/TR/REC-xml-names


Appendix H: Revision History

Note: Older versions of this specification might be available at http://xmpp.org/extensions/attic/

Version 0.1 (2002-08-26)

Initial version. (rn)

END