1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-12-21 23:28:51 -05:00
xeps/xep-0227.xml
Peter Saint-Andre d4ac2fe09f 0.2
git-svn-id: file:///home/ksmith/gitmigration/svn/xmpp/trunk@1470 4b5297f7-1745-476d-ba37-a9c6900126ab
2007-12-13 20:19:04 +00:00

364 lines
15 KiB
XML

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>Portable Import/Export Format for XMPP-IM Servers</title>
<abstract>This document specifies a file format for importing and exporting user data to and from XMPP-IM servers.</abstract>
&LEGALNOTICE;
<number>0227</number>
<status>Experimental</status>
<type>Standards Track</type>
<sig>Standards</sig>
<approver>Council</approver>
<dependencies>
<spec>XMPP IM</spec>
<spec>XEP-0049</spec>
<spec>XEP-0054</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>TO BE ASSIGNED</shortname>
<author>
<firstname>Magnus</firstname>
<surname>Henoch</surname>
<email>henoch@dtek.chalmers.se</email>
<jid>legoscia@jabber.cd.chalmers.se</jid>
</author>
<revision>
<version>0.2</version>
<date>2007-12-13</date>
<initials>mh</initials>
<remark><p>Use XInclude.</p></remark>
</revision>
<revision>
<version>0.1</version>
<date>2007-08-08</date>
<initials>psa</initials>
<remark><p>Initial published version.</p></remark>
</revision>
<revision>
<version>0.0.1</version>
<date>2007-07-27</date>
<initials>mh</initials>
<remark><p>Initial version.</p></remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p>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.</p>
</section1>
<section1 topic='Requirements' anchor='reqs'>
<p>The following constraints are imposed on this standard:</p>
<ul>
<li>
<p>The file format is XML-based.</p>
<p>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.</p>
</li>
<li>
<p>The data layout is flexible.</p>
<p>The data is contained in a single XML document; however, it can be split into several files using &w3xinclude;.</p>
</li>
<li>
<p>All user data is stored, but no server configuration data.</p>
<p>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.</p>
<p>Furthermore, the contents of MUC, Pubsub and other services are out of scope for this specification.</p>
</li>
<li>
<p>Multiple virtual hosts are supported.</p>
<p>Many server implementations can serve several hostnames in a single server instance. Thus this specification allows storing data from several virtual hosts.</p>
</li>
</ul>
</section1>
<section1 topic='Glossary' anchor='glossary'>
<ul>
<li><p>Exporting server.</p>
<p>The XMPP-IM server writing its user data to files, following this specification.</p>
</li>
<li><p>Importing server.</p>
<p>The XMPP-IM server reading data from such files.</p>
</li>
</ul>
</section1>
<section1 topic='File format' anchor='fileformat'>
<p>Data is contained in an XML document, whose root element is &lt;server-data/&gt; qualified by the 'http://www.xmpp.org/extensions/xep-0227.html#ns' namespace &NSNOTE;.</p>
<example caption='The root element'><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>
<server-data xmlns='http://www.xmpp.org/extensions/xep-0227.html#ns'>
[ ... ]
</server-data>
]]>
</example>
<p>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.</p>
<p>At any point in the file, an exporting server may put an XInclude &lt;include/&gt; element; see <link url='#xinclude'>Use of XInclude</link>.</p>
<section2 topic='Hosts' anchor='hosts'>
<p>The child elements of the &lt;server-data/&gt; elements are &lt;host/&gt; elements. Each &lt;host/&gt; element describes a virtual host, and has a 'jid' attribute that contains its JID.</p>
<p>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.</p>
<example caption='The host element'><![CDATA[
<?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> ]]>
</example>
</section2>
<section2 topic='Users' anchor='users'>
<p>Each user is represented by a &lt;user/&gt; element under the &lt;host/&gt; element. The &lt;user/&gt; 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.</p>
<example caption='The user element'><![CDATA[
<?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> ]]>
</example>
</section2>
<section2 topic='Rosters' anchor='rosters'>
<p>Each &lt;user/&gt; element SHOULD contain the user's roster in the form of a &lt;query/&gt; 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 &xmppim;.</p>
<example caption='The roster'><![CDATA[
<?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> ]]>
</example>
</section2>
<section2 topic='Offline Messages' anchor='offlinemessages'>
<p>If the exporting server stores messages received while the user was offline, it SHOULD include an &lt;offline-messages/&gt; element as a child of the &lt;user/&gt; element. This element contains all the stored messages to the user, if any, as &lt;message/&gt; elements qualified by the 'jabber:client' namespace, starting with the oldest.</p>
<example caption='Offline messages'><![CDATA[
<?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> ]]>
</example>
</section2>
<section2 topic='Private XML Storage' anchor='privatexmlstorage'>
<p>Private data stored by the server as specified in &xep0049; is represented in this format by including a &lt;query/&gt; element qualified by the 'jabber:iq:private' namespace as a child of the &lt;user/&gt; element. This &lt;query/&gt; element in turn contains all elements saved in private XML storage.</p>
<example caption='Private XML Storage'><![CDATA[
<?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> ]]>
</example>
</section2>
<section2 topic='vCards' anchor='vcards'>
<p>By &xep0054;, users can store vCards on the server. In this specification, vCards are child elements of the &lt;user/&gt; element, namely a &lt;vCard/&gt; element qualified by the 'vcard-temp' namespace.</p>
<example caption='vCards'><![CDATA[
<?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> ]]>
</example>
</section2>
</section1>
<section1 topic='Use of XInclude' anchor='xinclude'>
<p>At any point in the file, an exporting server may put an XInclude &lt;include/&gt; element, to split the data into several files. An importing server MUST support &lt;include/&gt; elements having an 'href' attribute containing a relative URI, having no 'parse' attribute, and having no 'xpointer' attribute; it MAY support other kinds of &lt;include/&gt; elements.</p>
<section2 topic='File and Directory Layout' anchor='xinclude-layout'>
<p>If an exporting server chooses to split the data into several files, it SHOULD use the following scheme:</p>
<p>The main file contains the &lt;server-data/&gt; element, which contains nothing but one &lt;include/&gt; 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".</p>
<example caption='The main file, which includes host files'><![CDATA[
<?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>
]]>
</example>
<p>Each host file contains a &lt;host/&gt; element, which contains nothing but one &lt;include/&gt; 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".</p>
<example caption='The host file, which includes user files'><![CDATA[
<?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>
]]>
</example>
<p>Each user file contains a &lt;user/&gt; element, and includes all data relating to that user.</p>
<example caption='The user file'><![CDATA[
<?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>
]]>
</example>
<p>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.</p>
</section2>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<p>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.</p>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
<p>This document requires no interaction with the Internet Assigned Numbers Authority (IANA).</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<section2 topic='Protocol Namespaces' anchor='ns'>
<p>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 &REGISTRAR; shall issue a permanent namespace in accordance with the process defined in Section 4 of &xep0053;.</p>
</section2>
</section1>
<section1 topic='XML Schema' anchor='schema'>
<code><![CDATA[
<?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>
]]></code>
</section1>
</xep>