Abstract: | This document specifies a file format for importing and exporting user data to and from XMPP-IM servers. |
Authors: | Magnus Henoch, Waqas Hussain |
Copyright: | © 1999 - 2010 XMPP Standards Foundation. SEE LEGAL NOTICES. |
Status: | Proposed |
Type: | Standards Track |
Version: | 0.3 |
Last Updated: | 2009-10-16 |
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. The Last Call ends on 2009-11-06. Please send your feedback to the standards@xmpp.org discussion list.
1. Introduction
2. Requirements
3. Glossary
4. File format
4.1. Hosts
4.2. Users
4.3. Rosters
4.4. Offline Messages
4.5. Private XML Storage
4.6. vCards
4.7. Privacy Lists
4.8. Incoming Subscription Requests
5. Use of XInclude
5.1. File and Directory Layout
6. Security Considerations
7. IANA Considerations
8. XMPP Registrar Considerations
8.1. Protocol Namespaces
9. XML Schema
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
Different implementations of XMPP-IM servers store user data in various ways, and many implementations have more than one storage format. This leads to problems when a server administrator wants to switch to another implementation or storage format -- the implementation is as likely as not to have an import mechanism that can read the user data in its current form. This document attempts to solve that problem by defining a common file format for import and export of user data in XMPP-IM servers.
The following constraints are imposed on this standard:
The file format is XML-based.
XMPP-IM servers already have tools to process XML data. This also allows extension of the format using namespaces. Furthermore, some of the data that needs to be stored is by definition already in XML form.
The data layout is flexible.
The data is contained in a single XML document; however, it can be split into several files using XInclude [1].
All user data is stored, but no server configuration data.
User data has similar form throughout the XMPP world, but server configuration is implementation-specific. Therefore this specification does not attempt to transfer any aspects of the server configuration from one server to another.
Furthermore, the contents of MUC, Pubsub and other services are out of scope for this specification.
Multiple virtual hosts are supported.
Many server implementations can serve several hostnames in a single server instance. Thus this specification allows storing data from several virtual hosts.
Data is contained in an XML document, whose root element is <server-data/> qualified by the 'http://www.xmpp.org/extensions/xep-0227.html#ns' namespace (see Protocol Namespaces regarding issuance of one or more permanent namespaces).
<?xml version='1.0' encoding='UTF-8'?> <server-data xmlns='http://www.xmpp.org/extensions/xep-0227.html#ns'> [ ... ] </server-data>
At any point in the file, an exporting server may put elements qualified by a namespace not mentioned in this specification. The exported data SHOULD be meaningful without the extensions. An importing server that encounters a namespace that it doesn't understand, or otherwise is unable to import all given data, SHOULD ignore the unknown data, SHOULD notify the operator, and MAY offer to terminate the process.
At any point in the file, an exporting server may put an XInclude <include/> element; see Use of XInclude.
The child elements of the <server-data/> elements are <host/> elements. Each <host/> element describes a virtual host, and has a 'jid' attribute that contains its JID.
An importing server MAY automatically adjust its list of virtual hosts to fit the ones present in the data being imported. If it does not, it SHOULD notify the operator about any mismatch.
<?xml version='1.0' encoding='UTF-8'?> <server-data xmlns='http://www.xmpp.org/extensions/xep-0227.html#ns'> <host jid='capulet.com'> [ ... ] </host> <host jid='montague.net'> [ ... ] </host> </server-data>
Each user is represented by a <user/> element under the <host/> element. The <user/> element MUST have a 'name' attribute, which contains the node part of the user's JID, and SHOULD have a 'password' attribute, which contains the user's password.
<?xml version='1.0' encoding='UTF-8'?> <server-data xmlns='http://www.xmpp.org/extensions/xep-0227.html#ns'> <host jid='capulet.com'> <user name='juliet' password='s3crEt'> [ ... ] </user> </host> <host jid='montague.net'> <user name='romeo' password='iLuvJuLi3T'> [ ... ] </user> </host> </server-data>
Each <user/> element SHOULD contain the user's roster in the form of a <query/> element qualified by the 'jabber:iq:roster' namespace. This element contains the user's roster in the same format as when retrieving the roster from the server, as described in section 7.3 of XMPP IM [2].
<?xml version='1.0' encoding='UTF-8'?> <server-data xmlns='http://www.xmpp.org/extensions/xep-0227.html#ns'> <host jid='capulet.com'> <user name='juliet' password='s3crEt'> <query xmlns='jabber:iq:roster'> <item jid='romeo@montague.net' name='Romeo' subscription='both'> <group>Friends</group> </item> </query> </user> </host> </server-data>
If the exporting server stores messages received while the user was offline, it SHOULD include an <offline-messages/> element as a child of the <user/> element. This element contains all the stored messages to the user, if any, as <message/> elements qualified by the 'jabber:client' namespace, starting with the oldest.
<?xml version='1.0' encoding='UTF-8'?> <server-data xmlns='http://www.xmpp.org/extensions/xep-0227.html#ns'> <host jid='capulet.com'> <user name='juliet' password='s3crEt'> <offline-messages> <message xmlns='jabber:client' from='romeo@montague.net/orchard' to='juliet@capulet.com/balcony' type='chat'> <body>Neither, fair saint, if either thee dislike.</body> <delay xmlns='urn:xmpp:delay' from='capulet.com' stamp='1469-07-21T00:32:29Z'> Offline Storage </delay> </message> </offline-messages> </user> </host> </server-data>
Private data stored by the server as specified in Private XML Storage [3] is represented in this format by including a <query/> element qualified by the 'jabber:iq:private' namespace as a child of the <user/> element. This <query/> element in turn contains all elements saved in private XML storage.
<?xml version='1.0' encoding='UTF-8'?> <server-data xmlns='http://www.xmpp.org/extensions/xep-0227.html#ns'> <host jid='shakespeare.lit'> <user name='hamlet' password='2b0Rnot2B'> <query xmlns="jabber:iq:private"> <exodus xmlns="exodus:prefs"> <defaultnick>Hamlet</defaultnick> </exodus> </query> </user> </host> </server-data>
By vcard-temp [4], users can store vCards on the server. In this specification, vCards are child elements of the <user/> element, namely a <vCard/> element qualified by the 'vcard-temp' namespace.
<?xml version='1.0' encoding='UTF-8'?> <server-data xmlns='http://www.xmpp.org/extensions/xep-0227.html#ns'> <host jid='capulet.com'> <user name='juliet' password='s3crEt'> <vCard xmlns='vcard-temp'> <FN>Juliet Capulet</FN> </vCard> </user> </host> </server-data>
Privacy lists, as specified in Privacy Lists [5], are represented in this format by including a <query/> element qualified by the 'jabber:iq:privacy' namespace as a child of the <user/> element. This element should contain all privacy lists associated with the user. A default privacy list, if set, is specified by including a <default/> element as a child of the <query/> element.
<?xml version='1.0' encoding='UTF-8'?> <server-data xmlns='http://www.xmpp.org/extensions/xep-0227.html#ns'> <host jid='capulet.com'> <user name='juliet' password='s3crEt'> <query xmlns='jabber:iq:privacy'> <default name='public'/> <list name='public'> <item type='jid' value='tybalt@example.com' action='deny' order='1'/> <item action='allow' order='2'/> </list> <list name='private'> <item type='subscription' value='both' action='allow' order='10'/> <item action='deny' order='15'/> </list> </query> </user> </host> </server-data>
Each <user/> element SHOULD contain pending incoming subscription requests associated with the user's account. Incoming subscription requests are represented by including <presence/> elements qualified by the 'jabber:client' namespace with the 'type' attribute set to a value of 'subscribe' as children of the <user/> element.
<?xml version='1.0' encoding='UTF-8'?> <server-data xmlns='http://www.xmpp.org/extensions/xep-0227.html#ns'> <host jid='capulet.com'> <user name='juliet' password='s3crEt'> <presence xmlns='jabber:client' type='subscribe' id='xk3h1v69' from='romeo@montague.net'> <nick xmlns="http://jabber.org/protocol/nick">Romeo</nick> </presence> <presence xmlns='jabber:client' type='subscribe' from='mercutio@montague.net'/> </user> </host> </server-data>
An exporting server may split the data in several files by using the XInclude <include/> element. An importing server MUST support <include/> elements having an 'href' attribute containing a relative URI, having no 'parse' attribute, and having no 'xpointer' attribute; it MAY support other kinds of <include/> elements. An exporting server SHOULD NOT include and an importing server SHOULD NOT process <include/> elements which are descendants, but not children of the <user/> element (since these may be part of user data).
If an exporting server chooses to split the data into several files, it SHOULD use the following scheme:
The main file contains the <server-data/> element, which contains nothing but one <include/> element for each host. The file included for a certain host is placed in the same directory as the main file, and is named by appending ".xml" to the JID of the host, e.g. "capulet.com.xml".
<?xml version='1.0' encoding='UTF-8'?> <server-data xmlns='http://www.xmpp.org/extensions/xep-0227.html#ns' xmlns:xi='http://www.w3.org/2001/XInclude'> <xi:include href='capulet.com.xml'/> <xi:include href='montague.net.xml'/> </server-data>
Each host file contains a <host/> element, which contains nothing but one <include/> element for each user of the host. The file included for a certain user is placed in a subdirectory whose name is the JID of the host, and is named by appending ".xml" to the node part of the user's JID, e.g. "capulet.com/juliet.xml".
<?xml version='1.0' encoding='UTF-8'?> <host xmlns='http://www.xmpp.org/extensions/xep-0227.html#ns' xmlns:xi='http://www.w3.org/2001/XInclude' jid='capulet.com'> <xi:include href='capulet.com/juliet.xml'/> <xi:include href='capulet.com/mercutio.xml'/> </host>
Each user file contains a <user/> element, and includes all data relating to that user.
<?xml version='1.0' encoding='UTF-8'?> <user xmlns='http://www.xmpp.org/extensions/xep-0227.html#ns' name='juliet' password='s3crEt'> <query xmlns='jabber:iq:roster'> <item jid='romeo@montague.net' name='Romeo' subscription='both'> <group>Friends</group> </item> </query> <vCard xmlns='vcard-temp'> <FN>Juliet Capulet</FN> </vCard> <offline-messages> <message xmlns='jabber:client' from='romeo@montague.net/orchard' to='juliet@capulet.com/balcony' type='chat'> <body>Neither, fair saint, if either thee dislike.</body> <delay xmlns='urn:xmpp:delay' from='capulet.com' stamp='1469-07-21T00:32:29Z'> Offline Storage </delay> </message> </offline-messages> </user>
The definition of JIDs ensures that this generates valid file names on traditional Unix-like file systems, except for possible length constraints. However, various constraints may force an exporting server to alter this scheme. In any case, the importing server MUST NOT rely on this layout, but MUST do proper XInclude processing.
Exported data files are to be handled with care, since they contain data that users expect to be protected, in particular passwords. An exporting server SHOULD make sure that the generated file is not accessible to unauthorized persons, e.g. by enforcing strict file permissions.
XInclude <include/> elements which are indirect descendants of the <user/> element SHOULD be treated as opaque user data, and SHOULD NOT be processed.
This document requires no interaction with the Internet Assigned Numbers Authority (IANA).
Until this specification advances to a status of Draft, its associated namespace shall be "http://www.xmpp.org/extensions/xep-0227.html#ns"; upon advancement of this specification, the XMPP Registrar [6] shall issue a permanent namespace in accordance with the process defined in Section 4 of XMPP Registrar Function [7].
<?xml version='1.0' encoding='UTF-8'?> <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://www.xmpp.org/extensions/xep-0227.html#ns' xmlns='http://www.xmpp.org/extensions/xep-0227.html#ns' elementFormDefault='qualified'> <xs:element name='server-data'> <xs:complexType> <xs:sequence> <xs:element ref='host' maxOccurs='unbounded'/> <xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded'/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name='host'> <xs:complexType> <xs:sequence> <xs:element ref='user' maxOccurs='unbounded'/> <xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded'/> </xs:sequence> <xs:attribute name='jid' type='xs:string' use='required'/> </xs:complexType> </xs:element> <xs:element name='user'> <xs:complexType> <xs:sequence> <xs:element ref='offline-messages' minOccurs='0' maxOccurs='1'/> <xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded'/> </xs:sequence> <xs:attribute name='name' type='xs:string' use='required'/> <xs:attribute name='password' type='xs:string' use='optional'/> </xs:complexType> </xs:element> <xs:element name='offline-messages'> <xs:complexType> <xs:sequence> <xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded'/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
Series: XEP
Number: 0227
Publisher: XMPP Standards Foundation
Status:
Proposed
Type:
Standards Track
Version: 0.3
Last Updated: 2009-10-16
Approving Body: XMPP Council
Dependencies: XMPP IM, XEP-0049, XEP-0054
Supersedes: None
Superseded By: None
Short Name: TO BE ASSIGNED
Source Control:
HTML
RSS
Email:
henoch@dtek.chalmers.se
JabberID:
legoscia@jabber.cd.chalmers.se
Email:
waqas20@gmail.com
JabberID:
waqas@jaim.at
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.
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>.
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".
1. XML Inclusions (XInclude) 1.0 <http://www.w3.org/TR/xinclude/>.
2. RFC 3921: Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence <http://tools.ietf.org/html/rfc3921>.
3. XEP-0049: Private XML Storage <http://xmpp.org/extensions/xep-0049.html>.
4. XEP-0054: vcard-temp <http://xmpp.org/extensions/xep-0054.html>.
5. XEP-0016: Privacy Lists <http://xmpp.org/extensions/xep-0016.html>.
6. 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://xmpp.org/registrar/>.
7. XEP-0053: XMPP Registrar Function <http://xmpp.org/extensions/xep-0053.html>.
Note: Older versions of this specification might be available at http://xmpp.org/extensions/attic/
Modified to include feedback received during the initial Last Call. Added sections for privacy lists and incoming subscriptions, as well as text on XInclude security.
(wh)Use XInclude.
(mh)Initial published version.
(psa)Initial version.
(mh)END