No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0068.xml 18KB

  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. %ents;
  5. ]>
  6. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  7. <xep>
  8. <header>
  9. <title>Field Standardization for Data Forms</title>
  10. <abstract>This document specifies how to standardize field variables used in the context of jabber:x:data forms.</abstract>
  12. <number>0068</number>
  13. <status>Active</status>
  14. <type>Informational</type>
  15. <sig>Standards</sig>
  16. <dependencies>
  17. <spec>XMPP Core</spec>
  18. <spec>XEP-0004</spec>
  19. </dependencies>
  20. <supersedes/>
  21. <supersededby/>
  22. <shortname>formtypes</shortname>
  23. <registry/>
  24. &hildjj;
  25. &stpeter;
  26. <revision>
  27. <version>1.2</version>
  28. <date>2012-05-28</date>
  29. <initials>psa/jjh</initials>
  30. <remark>Removed mandates about x- prefix in accordance with IETF BCP, and added more specific recommendations for naming of fields in XSF and non-XSF forms.</remark>
  31. </revision>
  32. <revision>
  33. <version>1.1</version>
  34. <date>2004-07-07</date>
  35. <initials>psa</initials>
  36. <remark>Specified ability to standardize field option values.</remark>
  37. </revision>
  38. <revision>
  39. <version>1.0</version>
  40. <date>2003-08-18</date>
  41. <initials>psa</initials>
  42. <remark>Per a vote of the Jabber Council, advanced status to Active.</remark>
  43. </revision>
  44. <revision>
  45. <version>0.3</version>
  46. <date>2003-06-05</date>
  47. <initials>psa</initials>
  48. <remark>Specified rules regarding registration and naming of FORM_TYPEs and associated fields.</remark>
  49. </revision>
  50. <revision>
  51. <version>0.2</version>
  52. <date>2003-05-09</date>
  53. <initials>psa</initials>
  54. <remark>Clarified the relation of FORM_TYPE to registered namespaces; defined registry format; added IQ example.</remark>
  55. </revision>
  56. <revision>
  57. <version>0.1</version>
  58. <date>2003-01-22</date>
  59. <initials>jjh</initials>
  60. <remark>Initial version.</remark>
  61. </revision>
  62. </header>
  63. <section1 topic='Introduction' anchor='intro'>
  64. <p>XMPP extensions that reuse &xep0004;, such as &xep0045; and &xep0050;, typically need a way to gather data from both humans (using a GUI format) and computer processes (using a pre-defined but flexible format). The 'jabber:x:data' namespace provides an adequate mechanism for both of these uses, as long as computer processes can rely on the var=&quot;&quot; names on a particular type of form. This document defines a mechanism for the &REGISTRAR; to standardize the field names in such forms, thus enabling XMPP clients to process forms as they have to this point while giving protocol authors a way to specify a mechanism for non-GUI processors to determine the semantic meanings of forms and their constituent fields.</p>
  65. </section1>
  66. <section1 topic='Requirements' anchor='reqs'>
  67. <ol>
  68. <li>Forms must continue to be presentable to humans for data entry.</li>
  69. <li>XMPP clients that know how to process generic jabber:x:data messages must be supported; the basic format of jabber:x:data must not change.</li>
  70. <li>If a form type is used in the context of a standards-track protocol, it should be standardized and registered; however, there is no requirement that all form types must be registered (e.g., form types used in custom applications).</li>
  71. <li>Forms that are not directed <em>to</em> an entity must be able to traverse the entity (e.g., a form sent to a MUC room, intended for the participants of the room, and not the room itself).</li>
  72. <li>Forms must continue to be flexible for implementations; unknown future expansion fields must not be limited.</li>
  73. <li>The chosen approach must work for forms embedded in &MESSAGE; stanzas as well as in &IQ; stanzas.</li>
  74. </ol>
  75. </section1>
  76. <section1 topic='Approach' anchor='approach'>
  77. <section2 topic='Overview' anchor='approach-overview'>
  78. <p>Within XMPP, namespaces are used to scope data that conforms to a schema (often data that extends the core protocol in some fashion). In addition, namespaces can also provide context for the field variable names used in jabber:x:data forms and reports. This proposal makes that association explicit by defining a mechanism for linking a namespace name with a form along with the field names and types used in that form. Specifically, the namespace name is specified in the form as the value of a hidden variable called "FORM_TYPE".</p>
  79. </section2>
  80. <section2 topic='Whether to Register' anchor='approach-register'>
  81. <p>The first decision-point is whether a FORM_TYPE needs to be registered with the XMPP Registrar. The following rules apply:</p>
  82. <ol>
  83. <li>If the FORM_TYPE is used in the context of a form defined in a XEP published by the &XSF;, it MUST be registered.</li>
  84. <li>If the FORM_TYPE is used in the context of some other XMPP protocol but the form is not defined in a XEP, it MAY be registered.</li>
  85. <li>If the FORM_TYPE is used in the context of a custom protocol, it MAY be registered.</li>
  86. </ol>
  87. </section2>
  88. <section2 topic='FORM_TYPE Names' anchor='approach-formtypes'>
  89. <p>While the value of the FORM_TYPE attribute SHOULD be considered an opaque string from the application perspective, the following rules apply:</p>
  90. <ol>
  91. <li>For custom protocols, the name SHOULD be an HTTP URI that is managed by the namespace owner (e.g., "").</li>
  92. <li>For all new protocols approved by the XSF, the name MUST be a "urn:xmpp:*" URN in accordance with &rfc4854; and Section 4 of &xep0053;.</li>
  93. <li>For "legacy" protocols managed by the XSF, the name SHOULD use the old-style "jabber:*:*" or "*" format.</li>
  94. </ol>
  95. </section2>
  96. <section2 topic='Field Names' anchor='approach-fieldnames'>
  97. <p>For FORM_TYPEs that are registered with the XMPP Registrar, the following rules apply:</p>
  98. <ol>
  99. <li>If the field is defined by the XSF (i.e., in a XEP), the field name SHALL be determined in accordance with the usual XSF consensus process and the field MUST be registered with the XMPP Registrar.</li>
  100. <li>If the field is defined outside the XSF, the field name SHALL follow the extension rules described below and the field MAY be registered with the XMPP Registrar.</li>
  101. </ol>
  102. <p>For FORM_TYPEs that are not registered with the XMPP Registrar, the field name SHALL follow the extension rules described below and the field typically will not be registered with the XMPP Registrar.</p>
  103. <p>The "namespace" of a field is assumed to be inherited from the FORM_TYPE. When an organization or project defines a field that is used in the context of a FORM_TYPE it does not manage (e.g., a non-XSF field contained in a form whose FORM_TYPE is managed by the XSF, or a third-party field contained in a form whose FORM_TYPE is managed by some other organization), the name of the field MUST be namespaced using &clark;, where the universal name portion SHOULD be a URI controlled by the extending organization or project, e.g., a field name of "{}time_restrictions".</p>
  104. <p>For reasons that are lost in the mists of time, some XMPP extension protocols produced by the XSF, such as &xep0045; and &xep0060;, prefix their field names with strings like "muc#" and "pubsub#". There is no good reason to apply that convention to new XSF extensions. Indeed, there is even no good reason to apply that convention to the names of new fields defined by the XSF for those existing XSF extensions; however, the practice is harmless for those existing extensions (since a string such as "{}pubsub#subscriber_jid" can be considered equivalent to a string such as "pubsub#subscriber_jid"), and this document does not actively recommend deprecating the convention.</p>
  105. <p class='box'>Note: Older versions of this specification mandated that unregistered field names had to begin with the prefix "x-". In accordance with &rfc6648;, that mandate has been removed. However, existing "x-" field names are acceptable and can be registered with the XMPP Registrar as described above.</p>
  106. </section2>
  107. <section2 topic='Field Values' anchor='approach-fieldvalues'>
  108. <p>Field values MAY also be registered; refer to the <link url='registrar'>XMPP Registrar</link> section of this document.</p>
  109. </section2>
  110. <section2 topic='Uniqueness and Comparison' anchor='approach-comparison'>
  111. <p>FORM_TYPE names, field names, and field values MUST be compared as strings. The use of URIs in FORM_TYPE names and field names is simply a recommended method for insuring uniqueness, and other such methods are acceptable (e.g., Java-like reverse domain names such as "").</p>
  112. </section2>
  113. </section1>
  114. <section1 topic='Use Cases' anchor='usecases'>
  115. <section2 topic='Unspecified Form' anchor='usecases-unspecified'>
  116. <p>These are forms that do not have a hidden field of name FORM_TYPE.
  117. Existing processing rules still apply.</p>
  118. <example caption='Message with no FORM_TYPE'><![CDATA[
  119. <message
  120. from=''
  121. to=''>
  122. <thread>vote-thread-reatmon-134</thread>
  123. <x xmlns='jabber:x:data' type='form'>
  124. <title>Vote #134</title>
  125. <instructions>
  126. This is the vote to pick a new mascot.
  127. Thanks for your time!
  128. </instructions>
  129. <field var='mascot' type='list-single'>
  130. <required/>
  131. <option label='Light Bulb'><value>light_bulb</value></option>
  132. <option label='Penguin'><value>penguin</value></option>
  133. <option label='Moose'><value>moose</value></option>
  134. <option label='Triangle Man'><value>triangle_man</value></option>
  135. <option label='Other'><value>other</value></option>
  136. </field>
  137. </x>
  138. </message>
  139. ]]></example>
  140. </section2>
  141. <section2 topic='Correctly Specified FORM_TYPE' anchor='usecases-correct'>
  142. <p>In the following example, the FORM_TYPE is '', all of the fields whose names start with "pubsub#" are registered with the XMPP Registrar (see &xep0060;), and the custom "time_restrictions" field defined by the organization at uses Clark Notation in the field name.</p>
  143. <example caption='Message with FORM_TYPE'><![CDATA[
  144. <message to="node-owner" from="">
  145. <x xmlns="jabber:x:data" type="form">
  146. <title>PubSub subscriber request</title>
  147. <instructions>To approve this entity's subscription request,
  148. click the OK button. To deny the request, click the
  149. cancel button.</instructions>
  150. <field var="FORM_TYPE" type="hidden">
  151. <value></value>
  152. </field>
  153. <field var="pubsub#node" type="hidden">
  154. <value>generic/pgm-mp3-player</value>
  155. </field>
  156. <field var="pubsub#subscriber_jid" type="jid-single"
  157. label="Jabber ID of Subscriber">
  158. <value></value>
  159. </field>
  160. <field var="{}time_restrictions" type="text-multi"
  161. label="Limit to these time ranges">
  162. <value>09:00-12:00</value>
  163. <value>13:00-17:00</value>
  164. </field>
  165. </x>
  166. </message>
  167. ]]></example>
  168. </section2>
  169. <section2 topic='Incorrectly Specified FORM_TYPE' anchor='usecases-incorrect'>
  170. <p>If the FORM_TYPE field is not hidden, it MUST be ignored as a context indicator.</p>
  171. <example caption='Message with bad FORM_TYPE'><![CDATA[
  172. <message to="" from="">
  173. <x xmlns="jabber:x:data" type="form">
  174. <title>Balcony Scene (Act 2, Scene 2)</title>
  175. <instructions>But soft! What light through yonder window breaks?</instructions>
  176. <!-- Not hidden. Treated as any other text-single field. -->
  177. <field var="FORM_TYPE" type="text-single">
  178. <value></value>
  179. </field>
  180. <field var="light" type="list-multi">
  181. <option label="Juliet">Sun</option>
  182. <option lable="Maid">Moon</option>
  183. <option label="Eyes">Stars</option>
  184. </field>
  185. </x>
  186. </message>
  187. ]]></example>
  188. </section2>
  189. <section2 topic='IQ Example' anchor='usecases-IQ'>
  190. <p>The following example shows a user's interaction with a Multi-User Chat room in order to register with the room.</p>
  191. <example caption='User Requests Registration Requirements'><![CDATA[
  192. <iq
  193. from='hag66@shakespeare.lit/pda'
  194. to='darkcave@macbeth.shakespeare.lit'
  195. type='get'
  196. id='reg1'>
  197. <query xmlns='jabber:iq:register'/>
  198. </iq>
  199. ]]></example>
  200. <example caption='Service Returns Registration Form'><![CDATA[
  201. <iq
  202. type='result'
  203. from='darkcave@macbeth.shakespeare.lit'
  204. to='hag66@shakespeare.lit/pda'
  205. id='reg1'>
  206. <query xmlns='jabber:iq:register'>
  207. <instructions>
  208. To register on the web, visit http://shakespeare.lit/
  209. </instructions>
  210. <x xmlns='jabber:x:data' type='form'>
  211. <title>Dark Cave Registration</title>
  212. <instructions>
  213. Please provide the following information
  214. to register with this room.
  215. </instructions>
  216. <field
  217. type='hidden'
  218. var='FORM_TYPE'>
  219. <value></value>
  220. </field>
  221. <field
  222. type='text-single'
  223. label='First Name'
  224. var='muc#user_first'>
  225. <required/>
  226. </field>
  227. <field
  228. type='text-single'
  229. label='Last Name'
  230. var='muc#user_last'>
  231. <required/>
  232. </field>
  233. <field
  234. type='text-single'
  235. label='Desired Nickname'
  236. var='muc#user_roomnick'>
  237. <required/>
  238. </field>
  239. <field
  240. type='text-single'
  241. label='Your URL'
  242. var='muc#user_url'/>
  243. <field
  244. type='text-single'
  245. label='Email Address'
  246. var='muc#user_email'/>
  247. <field
  248. type='text-multi'
  249. label='FAQ Entry'
  250. var='muc#user_faqentry'/>
  251. </x>
  252. </query>
  253. </iq>
  254. ]]></example>
  255. <example caption='User Submits Registration Form'><![CDATA[
  256. <iq
  257. type='set'
  258. from='hag66@shakespeare.lit/pda'
  259. to='darkcave@macbeth.shakespeare.lit'
  260. id='reg2'>
  261. <query xmlns='jabber:iq:register'>
  262. <x xmlns='jabber:x:data' type='submit'>
  263. <field var='FORM_TYPE'>
  264. <value></value>
  265. </field>
  266. <field var='muc#user_first'>
  267. <value>Brunhilde</value>
  268. </field>
  269. <field var='muc#user_last'>
  270. <value>Entwhistle-Throckmorton</value>
  271. </field>
  272. <field var='muc#user_roomnick'>
  273. <value>thirdwitch</value>
  274. </field>
  275. <field var='muc#user_url'>
  276. <value>http://witchesonline/~hag66/</value>
  277. </field>
  278. <field var='muc#user_email'>
  279. <value>hag66@witchesonline</value>
  280. </field>
  281. <field var='muc#user_faqentry'>
  282. <value>Just another witch.</value>
  283. </field>
  284. </x>
  285. </query>
  286. </iq>
  287. ]]></example>
  288. </section2>
  289. </section1>
  290. <section1 topic='Implementation Notes' anchor='impl'>
  291. <p>If the FORM_TYPE field is not type=&quot;hidden&quot;, it does not have the special meaning defined herein.</p>
  292. <p>If the form is used in an IQ, the namespace of the &lt;query/&gt; element SHOULD match the base namespace of the FORM_TYPE. (One possible way of solving this problem would have been to reuse the &lt;query/&gt; tag from the IQ form of jabber:x:data within messages, but that would have meant that existing clients would not have been able to participate in these exchanges.)</p>
  293. </section1>
  294. <section1 topic='Security Considerations' anchor='security'>
  295. <p>Security-conscious programs that are using this approach should be careful to process only agreed-upon fields with agreed-upon types.</p>
  296. </section1>
  297. <section1 topic='IANA Considerations' anchor='iana'>
  298. <p>This document requires no interaction with &IANA;.</p>
  299. </section1>
  300. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  301. <section2 topic='Registries' anchor='registrar-reg'>
  302. <section3 topic='FORM_TYPEs Registry' anchor='registrar-reg-formtypes'>
  303. <p>The XMPP Registrar shall maintain a registry of information about submitted FORM_TYPEs.</p>
  304. <section4 topic='Process' anchor='registrar-reg-formtypes-process'>
  306. <code><![CDATA[
  307. <form_type>
  308. <name>FORM_TYPE namespace or namespace derivative</name>
  309. <doc>associated specification</doc>
  310. <desc>natural-language description of form type</desc>
  311. <field
  312. var='the_field_name'
  313. type='the_field_type'
  314. label='natural-language description of field'/>
  315. </form_type>
  316. ]]></code>
  317. <p>The registrant MAY register more than one FORM_TYPE at a time, each contained in a separate &lt;form_type/&gt; element. The registrant MAY also register more than one field at a time, each contained in a separate &lt;field/&gt; child element. Registrations of new fields within an existing FORM_TYPE MUST include the full XML snippet but SHOULD NOT include the FORM_TYPE description (only the name and the XEP number or other document identifier). Note that for ease of use the format for the &lt;field/&gt; element in the registry submission is the same as that defined in XEP-0004; in addition, the value of the 'type' attribute MUST be one of those defined in XEP-0004.</p>
  318. <p>In addition, a registrant MAY also register particular field option values for fields of type 'list-single' and 'list-multi'. The format for such submissions is as follows:</p>
  319. <code><![CDATA[
  320. <form_type>
  321. <name>FORM_TYPE namespace or namespace derivative</name>
  322. <doc>associated XEP or other document</doc>
  323. <desc>natural-language description of form type</desc>
  324. <field
  325. var='the_field_name'
  326. type='the_field_type'
  327. label='natural-language description of field'>
  328. <option label='natural-language description of option'>
  329. <value>the_value</value>
  330. </option>
  331. </field>
  332. </form_type>
  333. ]]></code>
  334. </section4>
  335. </section3>
  336. </section2>
  337. </section1>
  338. </xep>