XEP-0221: Data Forms Media Element

This specification defines an XMPP protocol extension for including media data in XEP-0004 data forms.

NOTICE: This document is currently within Last Call or under consideration by the XMPP Council for advancement to the next stage in the XSF standards process.

Document Information

Series: XEP
Number: 0221
Publisher: XMPP Standards Foundation
Status: Proposed
Type: Standards Track
Version: 0.2
Last Updated: 2008-01-30
Approving Body: XMPP Council
Dependencies: XMPP Core, XEP-0004
Supersedes: None
Superseded By: None
Wiki Page: <http://wiki.jabber.org/index.php/Data Forms Media Element (XEP-0221)>

Author Information

Ian Paterson

Email: ian.paterson@clientside.co.uk
JabberID: ian@zoofy.com

Peter Saint-Andre

JabberID: stpeter@jabber.org
URI: https://stpeter.im/

Legal Notices


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


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. In no event shall the XMPP Standards Foundation or the authors of this Specification be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification. ##

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 out of the use or inability to use 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 may be found at <http://www.xmpp.org/extensions/ipr-policy.shtml> or obtained by writing to XSF, P.O. Box 1641, Denver, CO 80201 USA).

Discussion Venue

The preferred venue for discussion of this document is the Standards discussion list: <http://mail.jabber.org/mailman/listinfo/standards>.

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

Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 3920) and XMPP IM (RFC 3921) 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.

Conformance Terms

The following 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".

Table of Contents

1. Introduction
2. Media Element
3. XMPP Registrar Considerations
    3.1. Protocol Namespaces
4. XML Schema
Revision History

1. Introduction

In certain protocols that make use of Data Forms [1], it can be helpful to include media data such as small images. One example of such a "using protocol" is Robot Challenges [2]. This document defines a method for including media data in a data form.

2. Media Element

The root element for media data is <media/>. This element MUST be qualified by the "urn:xmpp:tmp:media-element' namespace (see Protocol Namespaces regarding issuance of one or more permanent namespaces). The <media/> element MUST be contained within a <field/> element qualified by the 'jabber:x:data' namespace.

If the media is an image or video then the <media/> element SHOULD include 'height' and 'width' attributes specifying the recommended display size of the media in pixels.

The <media/> element MUST contain at least one <uri/> element to specify the out-of-band location of the media data. [3] The <uri/> element MUST contain a URI that indicates the location and MUST include a 'type' atribute that specifies the MIME type (see RFC 2045 [4]) of the media.

The <media/> element MAY also contain one or more <data/> elements for distributing the media in-band. The <data/> element MUST be qualified by the 'urn:xmpp:tmp:data-element' as defined in Data Element [5]. The encoded data SHOULD NOT be larger than 8 kilobytes. [6]

Example 1. Audio Media Element

<media xmlns='urn:xmpp:tmp:media-element'>
  <uri type='audio/x-wav'>
  <uri type='audio/ogg-speex'>
  <uri type='audio/mpeg'>
  <data xmlns='urn:xmpp:tmp:data-element' 
        alt='An audio file'
    [ ... base64-encoded-audio ... ]

The following example is provided only for the purpose of illustration; consult the specifications for using protocols to see canonical examples.

Example 2. Inclusion in Data Form

<x xmlns='jabber:x:data' type='form'>
  [ ... ]
  <field var='ocr'>
    <media xmlns='xmlns='urn:xmpp:tmp:media-element'
      <uri type='image/jpeg'>
      <data xmlns='urn:xmpp:tmp:data-element'
            type='image/jpeg'> ** Base64 encoded image ** </data>
  [ ... ]

3. XMPP Registrar Considerations

3.1 Protocol Namespaces

Until this specification advances to a status of Draft, its associated namespace shall be "urn:xmpp:tmp:media-element"; upon advancement of this specification, the XMPP Registrar [7] shall issue a permanent namespace in accordance with the process defined in Section 4 of XMPP Registrar Function [8].

4. XML Schema

<?xml version='1.0' encoding='UTF-8'?>



  <xs:element name='media'>
      <xs:sequence xmlns:data='urn:xmpp:tmp:data-element'>
        <xs:element ref='uri' minOccurs='1' maxOccurs='unbounded'/>
        <xs:element ref='data:data' minOccurs='0' maxOccurs='unbounded'/>
      <xs:attribute name='height' type='xs:unsignedShort' use='optional'/>
      <xs:attribute name='width' type='xs:unsignedShort' use='optional'/>

  <xs:element name='uri'>
        <xs:extension base='xs:string'>
          <xs:attribute name='type' type='xs:string' use='required'/>



1. XEP-0004: Data Forms <http://www.xmpp.org/extensions/xep-0004.html>.

2. XEP-0158: Robot Challenges <http://www.xmpp.org/extensions/xep-0158.html>.

3. Constrained execution environments prevent some clients (e.g., Web clients) from rendering media unless it has been received out-of-band.

4. RFC 2045: Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies <http://tools.ietf.org/html/rfc2045>.

5. XEP-0231: Data Element <http://www.xmpp.org/extensions/xep-0231.html>.

6. If a stanza contains more than one <data/> element, the sending entity MUST take care not to trigger server-defined bandwidth limits.

7. The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see <http://www.xmpp.org/registrar/>.

8. XEP-0053: XMPP Registrar Function <http://www.xmpp.org/extensions/xep-0053.html>.

Revision History

Version 0.2 (2008-01-30)

Modified to reuse data element from XEP-0231. (psa)

Version 0.1 (2007-07-11)

Initial version, split off from XEP-0158. (psa/ip)