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-0004.xml 41KB

  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>Data Forms</title>
  10. <abstract>This specification defines an XMPP protocol extension for data forms that can be used in workflows such as service configuration as well as for application-specific data description and reporting. The protocol includes lightweight semantics for forms processing (such as request, response, submit, and cancel), defines several common field types (boolean, list options with single or multiple choice, text with single line or multiple lines, single or multiple JabberIDs, hidden fields, etc.), provides extensibility for future data types, and can be embedded in a wide range of applications. The protocol is not intended to provide complete forms-processing functionality as is provided in the W3C XForms technology, but instead provides a basic subset of such functionality for use by XMPP entities.</abstract>
  12. <number>0004</number>
  13. <status>Final</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <dependencies>
  17. <spec>XMPP Core</spec>
  18. </dependencies>
  19. <supersedes/>
  20. <supersededby/>
  21. <shortname>x-data</shortname>
  22. <schemaloc>
  23. <url></url>
  24. </schemaloc>
  25. &reatmon;
  26. &hildjj;
  27. &jer;
  28. &temas;
  29. &stpeter;
  30. <revision>
  31. <version>2.9</version>
  32. <date>2007-08-13</date>
  33. <initials>psa</initials>
  34. <remark><p>Clarified the definition and handling of the list-multi and list-single field types; specified that hidden field values should not be modified unless such behavior is defined for the using protocol; specified that a submission should include all fields provided in the empty form and may include additional fields, but that additional fields must be ignored if not understood by the form-processing entity.</p></remark>
  35. </revision>
  36. <revision>
  37. <version>2.8</version>
  38. <date>2007-05-21</date>
  39. <initials>psa</initials>
  40. <remark><p>Removed mentions of presence stanzas; added section on discovering support; added section on substantive changes in Final state.</p></remark>
  41. </revision>
  42. <revision>
  43. <version>2.7</version>
  44. <date>2006-01-25</date>
  45. <initials>psa</initials>
  46. <remark><p>Incorporated errata: (1) clarified rules regarding inclusion of option and value elements depending on field type; (2) clarified handling of default values; (3) added value elements to list-multi field in Example 2; (4) harmonized spelling of form-processing entity and form-submitting entity.</p></remark>
  47. </revision>
  48. <revision>
  49. <version>2.6</version>
  50. <date>2004-10-13</date>
  51. <initials>psa</initials>
  52. <remark><p>Incorporated errata: (1) corrected syntax of &lt;reported/&gt; element (&lt;field/&gt; element should not contain a &lt;value/&gt; child); (2) corrected Example 8.</p></remark>
  53. </revision>
  54. <revision>
  55. <version>2.5</version>
  56. <date>2004-05-07</date>
  57. <initials>psa</initials>
  58. <remark><p>Clarified terminology regarding form-processing entities and form-submitting entities; corrected several small errors in the schema.</p></remark>
  59. </revision>
  60. <revision>
  61. <version>2.4</version>
  62. <date>2004-05-04</date>
  63. <initials>psa</initials>
  64. <remark><p>Per discussion by the authors and Jabber Council, specified that the 'var' attribute is required for all field types except "fixed", for which the 'var' attribute is optional.</p></remark>
  65. </revision>
  66. <revision>
  67. <version>2.3</version>
  68. <date>2004-03-31</date>
  69. <initials>psa</initials>
  70. <remark><p>Formalization and further editorial revisions.</p></remark>
  71. </revision>
  72. <revision>
  73. <version>2.2</version>
  74. <date>2004-01-22</date>
  75. <initials>psa</initials>
  76. <remark><p>Editorial revisions.</p></remark>
  77. </revision>
  78. <revision>
  79. <version>2.1</version>
  80. <date>2003-02-16</date>
  81. <initials>psa</initials>
  82. <remark><p>Added schema.</p></remark>
  83. </revision>
  84. <revision>
  85. <version>2.0</version>
  86. <date>2002-12-09</date>
  87. <initials>psa</initials>
  88. <remark><p>Per a vote of the Jabber Council, changed status to Final.</p></remark>
  89. </revision>
  90. <revision>
  91. <version>1.1</version>
  92. <date>2002-10-15</date>
  93. <initials>rwe</initials>
  94. <remark><p>Call for Experience changes (see <link url="#draft-changes">Changes in Draft State</link> section). This version voted to Final on 2002-12-09.</p></remark>
  95. </revision>
  96. <revision>
  97. <version>1.0</version>
  98. <date>2002-04-24</date>
  99. <initials>psa</initials>
  100. <remark><p>Per a vote of the Jabber Council, changed status to Draft.</p></remark>
  101. </revision>
  102. <revision>
  103. <version>0.6</version>
  104. <date>2002-03-15</date>
  105. <initials>rwe</initials>
  106. <remark><p>Protocol tweaks based on Standards list discussion.</p></remark>
  107. </revision>
  108. <revision>
  109. <version>0.5</version>
  110. <date>2002-02-06</date>
  111. <initials>rwe</initials>
  112. <remark><p>Protocol tweaks based on implementation and discussion.</p></remark>
  113. </revision>
  114. <revision>
  115. <version>0.4</version>
  116. <date>2001-11-16</date>
  117. <initials>rwe</initials>
  118. <remark><p>Major redesign to attempt to clarify the scope of this document and limit what it is trying to solve.</p></remark>
  119. </revision>
  120. <revision>
  121. <version>0.3</version>
  122. <date>2001-07-23</date>
  123. <initials>rwe</initials>
  124. <remark><p>Protocol update</p></remark>
  125. </revision>
  126. <revision>
  127. <version>0.2</version>
  128. <date>2001-06-29</date>
  129. <initials>rwe</initials>
  130. <remark><p>Protocol update and DocBook version</p></remark>
  131. </revision>
  132. <revision>
  133. <version>0.1</version>
  134. <date>2001-01-25</date>
  135. <initials>rwe</initials>
  136. <remark><p>Initial release</p></remark>
  137. </revision>
  138. </header>
  139. <section1 topic='Introduction' anchor='intro'>
  140. <p>Several existing Jabber/XMPP protocols involve the exchange of structured data between users and applications for common tasks such as registration (&xep0077;) and searching (&xep0055;). Unfortunately, these early protocols were "hard coded" and thus place significant restrictions on the range of information that can be exchanged. Furthermore, other protocols (e.g., &xep0045;) may need to exchange data for purposes such as configuration, but the configuration options may differ depending on the specific implementation or deployment. Finally, developers may want to extend other protocols (e.g., &xep0030;) in a flexible manner in order to provide information that is not defined in the base protocol. In all of these cases, it would be helpful to use a generic data description format that can be used for dynamic forms generation and data "modelling" in a variety of circumstances.</p>
  141. <p>An example may be helpful. Let us imagine that when a user creates a multi-user chatroom on a text conferencing service, the service allows the user to configure the room in various ways. While most implementations will probably provide a somewhat common set of configurable features (discussion logging, maximum number of room occupants, etc.), there will be some divergence: perhaps one implementation will enable archiving of the room log in a variety of file types (XML, HTML, PDF, etc.) and for a variety of time periods (hourly, daily, weekly, etc.), whereas another implementation may present a boolean on/off choice of logging in only one format (e.g., daily logs saved in HTML). Obviously, the first implementation will have more configuration options than the second implementation. Rather than "hard-coding" every option via distinct XML elements (e.g., &lt;room_logging_period/&gt;), a better design would involve a more flexible format.</p>
  142. <p>The 'jabber:x:data' protocol described herein defines such a flexible format for use by Jabber/XMPP entities, steering a middle course between the simplicity of "name-value" pairs and the complexity of &w3xforms; (on which development had just begun when this protocol was designed). In many ways, 'jabber:x:data' is similar to the Forms Module of &w3xhtml;; however, it provides several Jabber-specific data types, enables applications to require data fields, integrates more naturally into the "workflow" semantics of IQ stanzas, and can be included as an extension of existing Jabber/XMPP protocols in ways that the XHTML Forms Module could not when this protocol was developed (especially because &w3xhtmlmod; did not exist at that time).</p>
  143. </section1>
  144. <section1 topic='Requirements' anchor='reqs'>
  145. <p>This document addresses the following requirements:</p>
  146. <ol>
  147. <li><strong>Data Gathering</strong> -- the protocol should enable a form-processing entity (commonly a server, service, or bot) to gather data from a form-submitting entity (commonly a client controlled by a human user); this should be done via distinct data fields (e.g., items in a questionnaire or configuration form), each of which can be a different data "type" and enable free-form input or a choice between multiple options (as is familiar from HTML forms).</li>
  148. <li><strong>Data Reporting</strong> -- the protocol should enable a form-processing entity to report data (e.g., search results) to a form-submitting entity, again via distinct data fields.</li>
  149. <li><strong>Portability</strong> -- the protocol should as much as possible define generic data formats and basic datatypes only; hints may be provided regarding the user interface, but they should be hints only and not hard-and-fast requirements.</li>
  150. <li><strong>Simplicity</strong> -- the protocol should be simple for clients to implement, and most of the complexity (e.g., data validation and processing) should be the responsibility of servers and components rather than clients.</li>
  151. <li><strong>Flexibility</strong> -- the protocol should be flexible and extensible rather than "hard-coded".</li>
  152. <li><strong>Compatibility</strong> -- the protocol should define an extension to existing Jabber/XMPP protocols and not break existing implementations unless absolutely necessary.</li>
  153. </ol>
  154. </section1>
  155. <section1 topic='Protocol' anchor='protocol'>
  156. <p>The base syntax for the 'jabber:x:data' namespace is as follows (a formal description can be found in the <link url="#schema">XML Schema</link> section below):</p>
  157. <code><![CDATA[
  158. <x xmlns='jabber:x:data'
  159. type='{form-type}'>
  160. <title/>
  161. <instructions/>
  162. <field var='field-name'
  163. type='{field-type}'
  164. label='description'>
  165. <desc/>
  166. <required/>
  167. <value>field-value</value>
  168. <option label='option-label'><value>option-value</value></option>
  169. <option label='option-label'><value>option-value</value></option>
  170. </field>
  171. </x>
  172. ]]></code>
  173. <p>The &X; element qualified by the 'jabber:x:data' namespace SHOULD be included either directly as a first-level child of a &MESSAGE; stanza or as a second-level child of an &IQ; stanza (where the first-level child is an element qualified by a "wrapper" namespace); see also the restrictions enumerated below.</p>
  174. <p>The OPTIONAL &lt;title/&gt; and &lt;instructions/&gt; elements enable the form-processing entity to label the form as a whole and specify natural-language instructions to be followed by the form-submitting entity. The XML character data for these elements SHOULD NOT contain newlines (the \n and \r characters), and any handling of newlines (e.g., presentation in a user interface) is unspecified herein; however, multiple instances of the &lt;instructions/&gt; element MAY be included.</p>
  175. <section2 topic='Form Types' anchor='protocol-formtypes'>
  176. <p>The data gathered or provided in a 'jabber:x:data' form can be situated in a number of different contexts. Examples include an empty form that needs to be filled out, a completed form, the results of a submission, a search result, or simply a set of data that is encapsulated using the 'jabber:x:data' namespace. The full context for the data is provided by three things:</p>
  177. <ol>
  178. <li>the "wrapper" protocol (i.e., the namespace whose root element is the direct child of the &IQ; stanza and the parent of the &X; element qualified by the 'jabber:x:data' namespace)</li>
  179. <li>the place of the form within a transaction (e.g., an IQ "set" or "result") or structured conversation (e.g., a message &lt;thread/&gt;)</li>
  180. <li>the 'type' attribute on the form's root &X; element</li>
  181. </ol>
  182. <p>The first two pieces of contextual information are provided by other protocols, whereas the form types are described in the following table.</p>
  183. <table caption='Form Types'>
  184. <tr>
  185. <th>Type</th>
  186. <th>Description</th>
  187. </tr>
  188. <tr>
  189. <td>form</td>
  190. <td>The form-processing entity is asking the form-submitting entity to complete a form.</td>
  191. </tr>
  192. <tr>
  193. <td>submit</td>
  194. <td>The form-submitting entity is submitting data to the form-processing entity. The submission MAY include fields that were not provided in the empty form, but the form-processing entity MUST ignore any fields that it does not understand.</td>
  195. </tr>
  196. <tr>
  197. <td>cancel</td>
  198. <td>The form-submitting entity has cancelled submission of data to the form-processing entity.</td>
  199. </tr>
  200. <tr>
  201. <td>result</td>
  202. <td>The form-processing entity is returning data (e.g., search results) to the form-submitting entity, or the data is a generic data set.</td>
  203. </tr>
  204. </table>
  205. <p>In order to maintain the context of the data as captured in the form type, the following rules MUST be observed:</p>
  206. <ul>
  207. <li><p>For &IQ; stanzas, the root element qualified by the "wrapper" namespace in a form of type "form" or "submit" MUST be returned in a form of type "result". The &X; element qualified by the 'jabber:x:data' namespace MUST be a child of the "wrapper" namespace's root element. As defined in &xmppcore;, the 'id' attribute MUST be copied in the IQ result. For data forms of type "form" or "result", the &IQ; stanza SHOULD be of type "result". For data forms of type "submit" or "cancel", the &IQ; stanza SHOULD be of type "set".</p></li>
  208. <li><p>For &MESSAGE; stanzas, the &lt;thread/&gt; SHOULD be copied in the reply if provided. The &X; element qualified by the 'jabber:x:data' namespace MUST be a child of the &MESSAGE; stanza.</p></li>
  209. </ul>
  210. </section2>
  211. <section2 topic='The Field Element' anchor='protocol-field'>
  212. <p>A data form of type "form", "submit", or "result" SHOULD contain at least one &lt;field/&gt; element; a data form of type "cancel" SHOULD NOT contain any &lt;field/&gt; elements.</p>
  213. <p>The &lt;field/&gt; element MAY contain any of the following child elements:</p>
  214. <dl>
  215. <di><dt>&lt;desc/&gt;</dt><dd>The XML character data of this element provides a natural-language description of the field, intended for presentation in a user-agent (e.g., as a "tool-tip", help button, or explanatory text provided near the field). The &lt;desc/&gt; element SHOULD NOT contain newlines (the \n and \r characters), since layout is the responsibility of a user agent, and any handling of newlines (e.g., presentation in a user interface) is unspecified herein. (Note: To provide a description of a field, it is RECOMMENDED to use a &lt;desc/&gt; element rather than a separate &lt;field/&gt; element of type "fixed".)</dd></di>
  216. <di><dt>&lt;required/&gt;</dt><dd>This element, which MUST be empty, flags the field as required in order for the form to be considered valid.</dd></di>
  217. <di><dt>&lt;value/&gt;</dt><dd>The XML character data of this element defines the default value for the field (according to the form-processing entity) in a data form of type "form", the data provided by a form-submitting entity in a data form of type "submit", or a data result in a data form of type "result". In data forms of type "form", if the form-processing entity provides a default value via the &lt;value/&gt; element, then the form-submitting entity SHOULD NOT attempt to enforce a different default value (although it MAY do so to respect user preferences or anticipate expected user input). Fields of type list-multi, jid-multi, text-multi, and hidden MAY contain more than one &lt;value/&gt; element; all other field types MUST NOT contain more than one &lt;value/&gt; element.</dd></di>
  218. <di><dt>&lt;option/&gt;</dt><dd>One of the options in a field of type "list-single" or "list-multi". The XML character of the &lt;value/&gt; child defines the option value, and the 'label' attribute defines a human-readable name for the option. The &lt;option/&gt; element MUST contain one and only one &lt;value/&gt; child. If the field is not of type "list-single" or "list-multi", it MUST NOT contain an &lt;option/&gt; element.</dd></di>
  219. </dl>
  220. <p>If the &lt;field/&gt; element type is anything other than "fixed" (see below), it MUST possess a 'var' attribute that uniquely identifies the field in the context of the form (if it is "fixed", it MAY possess a 'var' attribute). The &lt;field/&gt; element MAY possess a 'label' attribute that defines a human-readable name for the field. For data forms of type "form", each &lt;field/&gt; element SHOULD possess a 'type' attribute that defines the data "type" of the field data (if no 'type' is specified, the default is "text-single"); fields provided in the context of other forms types MAY possess a 'type' attribute as well. For data forms of type "submit", inclusion of the 'type' attribute is OPTIONAL, since the form-processing entity is assumed to understand the data types associated with forms that it processes.</p>
  221. <p>If fields are presented in a user interface (e.g., as items in a questionnaire or form result), the order of the field elements in the XML SHOULD determine the order of items presented to the user.</p>
  222. </section2>
  223. <section2 topic='Field Types' anchor='protocol-fieldtypes'>
  224. <p>The following field types represent data "types" that are commonly exchanged between Jabber/XMPP entities. These field types are not intended to be as comprehensive as the datatypes defined in, for example, &w3xmlschema2;, nor do they define user interface elements.</p>
  225. <table caption='Field Types'>
  226. <tr>
  227. <th>Type</th>
  228. <th>Description</th>
  229. </tr>
  230. <tr>
  231. <td>boolean</td>
  232. <td>The field enables an entity to gather or provide an either-or choice between two options. The default value is "false". &BOOLEANNOTE;</td>
  233. </tr>
  234. <tr>
  235. <td>fixed</td>
  236. <td>The field is intended for data description (e.g., human-readable text such as "section" headers) rather than data gathering or provision. The &lt;value/&gt; child SHOULD NOT contain newlines (the \n and \r characters); instead an application SHOULD generate multiple fixed fields, each with one &lt;value/&gt; child.</td>
  237. </tr>
  238. <tr>
  239. <td>hidden</td>
  240. <td>The field is not shown to the form-submitting entity, but instead is returned with the form. The form-submitting entity SHOULD NOT modify the value of a hidden field, but MAY do so if such behavior is defined for the "using protocol".</td>
  241. </tr>
  242. <tr>
  243. <td>jid-multi</td>
  244. <td>The field enables an entity to gather or provide multiple Jabber IDs. Each provided JID SHOULD be unique (as determined by comparison that includes application of the Nodeprep, Nameprep, and Resourceprep profiles of Stringprep as specified in <cite>XMPP Core</cite>), and duplicate JIDs MUST be ignored. *</td>
  245. </tr>
  246. <tr>
  247. <td>jid-single</td>
  248. <td>The field enables an entity to gather or provide a single Jabber ID. *</td>
  249. </tr>
  250. <tr>
  251. <td>list-multi</td>
  252. <td>The field enables an entity to gather or provide one or more options from among many. A form-submitting entity chooses one or more items from among the options presented by the form-processing entity and MUST NOT insert new options. The form-submitting entity MUST NOT modify the order of items as received from the form-processing entity, since the order of items MAY be significant.**</td>
  253. </tr>
  254. <tr>
  255. <td>list-single</td>
  256. <td>The field enables an entity to gather or provide one option from among many. A form-submitting entity chooses one item from among the options presented by the form-processing entity and MUST NOT insert new options. **</td>
  257. </tr>
  258. <tr>
  259. <td>text-multi</td>
  260. <td>The field enables an entity to gather or provide multiple lines of text. ***</td>
  261. </tr>
  262. <tr>
  263. <td>text-private</td>
  264. <td>The field enables an entity to gather or provide a single line or word of text, which shall be obscured in an interface (e.g., with multiple instances of the asterisk character).</td>
  265. </tr>
  266. <tr>
  267. <td>text-single</td>
  268. <td>The field enables an entity to gather or provide a single line or word of text, which may be shown in an interface. This field type is the default and MUST be assumed if a form-submitting entity receives a field type it does not understand.</td>
  269. </tr>
  270. </table>
  271. <p>* Note: Data provided for fields of type "jid-single" or "jid-multi" MUST contain one or more valid Jabber IDs, where validity is determined by the addressing rules defined in <cite>XMPP Core</cite> (see the <link url='#validation'>Data Validation</link> section below).</p>
  272. <p>** Note: The &lt;option/&gt; elements in list-multi and list-single fields MUST be unique, where uniqueness is determined by the value of the 'label' attribute and the XML character data of the &lt;value/&gt; element (i.e., both must be unique).</p>
  273. <p>*** Note: Data provided for fields of type "text-multi" SHOULD NOT contain any newlines (the \n and \r characters). Instead, the application SHOULD split the data into multiple strings (based on the newlines inserted by the platform), then specify each string as the XML character data of a distinct &lt;value/&gt; element. Similarly, an application that receives multiple &lt;value/&gt; elements for a field of type "text-multi" SHOULD merge the XML character data of the value elements into one text block for presentation to a user, with each string separated by a newline character as appropriate for that platform.</p>
  274. </section2>
  275. <section2 topic='Multiple Items in Form Results' anchor='protocol-results'>
  276. <p>In some contexts (e.g., the results of a search request), it may be necessary to communicate multiple items. Therefore, a data form of type "result" MAY contain two child elements not described in the basic syntax above:</p>
  277. <ol>
  278. <li>One and only &lt;reported/&gt; element, which can be understood as a "table header" describing the data to follow.</li>
  279. <li>Zero or more &lt;item/&gt; elements, which can be understood as "table cells" containing data (if any) that matches the request.</li>
  280. </ol>
  281. <p>The syntax is as follows:</p>
  282. <code><![CDATA[
  283. <x xmlns='jabber:x:data'
  284. type='result'>
  285. <reported>
  286. <field var='field-name' label='description' type='{field-type}'/>
  287. </reported>
  288. <item>
  289. <field var='field-name'>
  290. <value>field-value</value>
  291. </field>
  292. </item>
  293. <item>
  294. <field var='field-name'>
  295. <value>field-value</value>
  296. </field>
  297. </item>
  298. .
  299. .
  300. .
  301. </x>
  302. ]]></code>
  303. <p>Each of these elements MUST contain one or more &lt;field/&gt; children. The &lt;reported/&gt; element defines the data format for the result items by specifying the fields to be expected for each item; for this reason, the &lt;field/&gt; elements SHOULD possess a 'type' attribute and 'label' attribute in addition to the 'var' attribute, and SHOULD NOT contain a &lt;value/&gt; element. Each &lt;item/&gt; element defines one item in the result set, and MUST contain each field specified in the &lt;reported/&gt; element (although the XML character data of the &lt;value/&gt; element MAY be null).</p>
  304. </section2>
  305. </section1>
  306. <section1 topic='Data Validation' anchor='validation'>
  307. <p>Data validation is the responsibility of the form-processing entity (commonly a server, service, or bot) rather than the form-submitting entity (commonly a client controlled by a human user). This helps to meet the requirement for keeping client implementations simple. If the form-processing entity determines that the data provided is not valid, it SHOULD return a "Not Acceptable" error, optionally providing a textual explanation in the XMPP &lt;text/&gt; element or an application-specific child element that identifies the problem (see &xep0086; for information about mappings and formats).</p>
  308. </section1>
  309. <section1 topic='Examples' anchor='examples'>
  310. <p>For the sake of the following examples, let us suppose that there exists a bot hosting service on the Jabber network, located at &lt;botster.shakespeare.lit&gt;. This service enables registered users to create and configure new bots, find and interact with existing bots, and so on. We will assume that these interactions occur using the &xep0050; protocol, which is used as a "wrapper" protocol for data forms qualified by the 'jabber:x:data' namespace. The examples in the sections that follow show most of the features of the data forms protocol described above.</p>
  311. <p>Note: Additional examples can be found in the specifications for various "using protocols", such as <cite>XEP-0045: Multi-User Chat</cite> and <cite>XEP-0055: Jabber Search</cite>.</p>
  312. <section2 topic='Configuration' anchor='examples-config'>
  313. <p>The first step is for a user to create a new bot on the hosting service. We will assume that this is done by sending a "create" command to the desired bot:</p>
  314. <example caption="User Requests Bot Creation"><![CDATA[
  315. <iq from=''
  316. to='joogle@botster.shakespeare.lit'
  317. type='get'
  318. xml:lang='en'
  319. id='create1'>
  320. <command xmlns=''
  321. node='create'
  322. action='execute'/>
  323. </iq>
  324. ]]></example>
  325. <p>The hosting service then returns a data form to the user:</p>
  326. <example caption="Service Returns Bot Creation Form"><![CDATA[
  327. <iq from='joogle@botster.shakespeare.lit'
  328. to=''
  329. type='result'
  330. xml:lang='en'
  331. id='create1'>
  332. <command xmlns=''
  333. node='create'
  334. sessionid='create:20040408T0128Z'
  335. status='executing'>
  336. <x xmlns='jabber:x:data' type='form'>
  337. <title>Bot Configuration</title>
  338. <instructions>Fill out this form to configure your new bot!</instructions>
  339. <field type='hidden'
  340. var='FORM_TYPE'>
  341. <value>jabber:bot</value>
  342. </field>
  343. <field type='fixed'><value>Section 1: Bot Info</value></field>
  344. <field type='text-single'
  345. label='The name of your bot'
  346. var='botname'/>
  347. <field type='text-multi'
  348. label='Helpful description of your bot'
  349. var='description'/>
  350. <field type='boolean'
  351. label='Public bot?'
  352. var='public'>
  353. <required/>
  354. </field>
  355. <field type='text-private'
  356. label='Password for special access'
  357. var='password'/>
  358. <field type='fixed'><value>Section 2: Features</value></field>
  359. <field type='list-multi'
  360. label='What features will the bot support?'
  361. var='features'>
  362. <option label='Contests'><value>contests</value></option>
  363. <option label='News'><value>news</value></option>
  364. <option label='Polls'><value>polls</value></option>
  365. <option label='Reminders'><value>reminders</value></option>
  366. <option label='Search'><value>search</value></option>
  367. <value>news</value>
  368. <value>search</value>
  369. </field>
  370. <field type='fixed'><value>Section 3: Subscriber List</value></field>
  371. <field type='list-single'
  372. label='Maximum number of subscribers'
  373. var='maxsubs'>
  374. <value>20</value>
  375. <option label='10'><value>10</value></option>
  376. <option label='20'><value>20</value></option>
  377. <option label='30'><value>30</value></option>
  378. <option label='50'><value>50</value></option>
  379. <option label='100'><value>100</value></option>
  380. <option label='None'><value>none</value></option>
  381. </field>
  382. <field type='fixed'><value>Section 4: Invitations</value></field>
  383. <field type='jid-multi'
  384. label='People to invite'
  385. var='invitelist'>
  386. <desc>Tell all your friends about your new bot!</desc>
  387. </field>
  388. </x>
  389. </command>
  390. </iq>
  391. ]]></example>
  392. <p>The user then submits the configuration form:</p>
  393. <example caption="User Submits Bot Creation Form"><![CDATA[
  394. <iq from=''
  395. to='joogle@botster.shakespeare.lit'
  396. type='set'
  397. xml:lang='en'
  398. id='create2'>
  399. <command xmlns=''
  400. node='create'
  401. sessionid='create:20040408T0128Z'>
  402. <x xmlns='jabber:x:data' type='submit'>
  403. <field type='hidden' var='FORM_TYPE'>
  404. <value>jabber:bot</value>
  405. </field>
  406. <field type='text-single' var='botname'>
  407. <value>The Jabber Google Bot</value>
  408. </field>
  409. <field type='text-multi' var='description'>
  410. <value>This bot enables you to send requests to</value>
  411. <value>Google and receive the search results right</value>
  412. <value>in your Jabber client. It&apos; really cool!</value>
  413. <value>It even supports Google News!</value>
  414. </field>
  415. <field type='boolean' var='public'>
  416. <value>0</value>
  417. </field>
  418. <field type='text-private' var='password'>
  419. <value>v3r0na</value>
  420. </field>
  421. <field type='list-multi' var='features'>
  422. <value>news</value>
  423. <value>search</value>
  424. </field>
  425. <field type='list-single' var='maxsubs'>
  426. <value>50</value>
  427. </field>
  428. <field type='jid-multi' var='invitelist'>
  429. <value></value>
  430. <value></value>
  431. </field>
  432. </x>
  433. </command>
  434. </iq>
  435. ]]></example>
  436. <p>The service then returns the results to the user:</p>
  437. <example caption="Service Returns Bot Creation Result"><![CDATA[
  438. <iq from='joogle@botster.shakespeare.lit'
  439. to=''
  440. type='result'
  441. xml:lang='en'
  442. id='create2'>
  443. <command xmlns=''
  444. node='create'
  445. sessionid='create:20040408T0128Z'
  446. status='completed'>
  447. <x xmlns='jabber:x:data' type='result'>
  448. <field type='hidden' var='FORM_TYPE'>
  449. <value>jabber:bot</value>
  450. </field>
  451. <field type='text-single' var='botname'>
  452. <value>The Jabber Google Bot</value>
  453. </field>
  454. <field type='boolean' var='public'>
  455. <value>0</value>
  456. </field>
  457. <field type='text-private' var='password'>
  458. <value>v3r0na</value>
  459. </field>
  460. <field type='list-multi' var='features'>
  461. <value>news</value>
  462. <value>search</value>
  463. </field>
  464. <field type='list-single' var='maxsubs'>
  465. <value>50</value>
  466. </field>
  467. <field type='jid-multi' var='invitelist'>
  468. <value></value>
  469. <value></value>
  470. </field>
  471. </x>
  472. </command>
  473. </iq>
  474. ]]></example>
  475. </section2>
  476. <section2 topic='Search' anchor='examples-search'>
  477. <p>Now that the user has created this search bot, let us suppose that one of the friends he has invited decides to try it out by sending a search request:</p>
  478. <example caption="User Requests Search Form"><![CDATA[
  479. <iq from=''
  480. to='joogle@botster.shakespeare.lit'
  481. type='get'
  482. xml:lang='en'
  483. id='search1'>
  484. <command xmlns=''
  485. node='search'
  486. action='execute'/>
  487. </iq>
  488. ]]></example>
  489. <example caption="Service Returns Search Form"><![CDATA[
  490. <iq from='joogle@botster.shakespeare.lit'
  491. to=''
  492. type='result'
  493. xml:lang='en'
  494. id='search1'>
  495. <command xmlns=''
  496. node='search'
  497. status='executing'>
  498. <x xmlns='jabber:x:data' type='form'>
  499. <title>Joogle Search</title>
  500. <instructions>Fill out this form to search for information!</instructions>
  501. <field type='text-single'
  502. var='search_request'>
  503. <required/>
  504. </field>
  505. </x>
  506. </command>
  507. </iq>
  508. ]]></example>
  509. <example caption="User Submits Search Form"><![CDATA[
  510. <iq from=''
  511. to='joogle@botster.shakespeare.lit'
  512. type='get'
  513. xml:lang='en'
  514. id='search2'>
  515. <command xmlns=''
  516. node='search'>
  517. <x xmlns='jabber:x:data' type='submit'>
  518. <field type='text-single' var='search_request'>
  519. <value>verona</value>
  520. </field>
  521. </x>
  522. </command>
  523. </iq>
  524. ]]></example>
  525. <example caption="Service Returns Search Results"><![CDATA[
  526. <iq from='joogle@botster.shakespeare.lit'
  527. to=''
  528. type='result'
  529. xml:lang='en'
  530. id='search2'>
  531. <command xmlns=''
  532. node='search'
  533. status='completed'>
  534. <x xmlns='jabber:x:data' type='result'>
  535. <title>Joogle Search: verona</title>
  536. <reported>
  537. <field var='name'/>
  538. <field var='url'/>
  539. </reported>
  540. <item>
  541. <field var='name'>
  542. <value>Comune di Verona - Benvenuti nel sito ufficiale</value>
  543. </field>
  544. <field var='url'>
  545. <value></value>
  546. </field>
  547. </item>
  548. <item>
  549. <field var='name'>
  550. <value>benvenuto!</value>
  551. </field>
  552. <field var='url'>
  553. <value></value>
  554. </field>
  555. </item>
  556. <item>
  557. <field var='name'>
  558. <value>Universita degli Studi di Verona - Home Page</value>
  559. </field>
  560. <field var='url'>
  561. <value></value>
  562. </field>
  563. </item>
  564. <item>
  565. <field var='name'>
  566. <value>Aeroporti del Garda</value>
  567. </field>
  568. <field var='url'>
  569. <value></value>
  570. </field>
  571. </item>
  572. <item>
  573. <field var='name'>
  574. <value>Veronafiere - fiera di Verona</value>
  575. </field>
  576. <field var='url'>
  577. <value></value>
  578. </field>
  579. </item>
  580. </x>
  581. </command>
  582. </iq>
  583. ]]></example>
  584. </section2>
  585. </section1>
  586. <section1 topic='Service Discovery' anchor='disco'>
  587. <p>If an entity supports inclusion of the &X; element qualified by the 'jabber:x:data' namespace as a direct child of the &MESSAGE; stanza type, it MUST report support by including a service discovery feature of "jabber:x:data" &NSNOTE; in response to a Service Discovery information request:</p>
  588. <example caption="Service Discovery information request"><![CDATA[
  589. <iq type='get'
  590. from=''
  591. to=''
  592. id='disco1'>
  593. <query xmlns=''/>
  594. </iq>
  595. ]]></example>
  596. <example caption="Service Discovery information response"><![CDATA[
  597. <iq type='result'
  598. from=''
  599. to=''
  600. id='disco1'>
  601. <query xmlns=''>
  602. ...
  603. <feature var='jabber:x:data'/>
  604. ...
  605. </query>
  606. </iq>
  607. ]]></example>
  608. <p>If an entity supports data forms indirectly through inclusion of data forms in a wrapper namespace (rather than directly within a &MESSAGE; stanza), it MUST NOT advertise support for the 'jabber:x:data' namespace, since support is implicit in support for the wrapper protocol.</p>
  609. </section1>
  610. <section1 topic='Security Considerations' anchor='security'>
  611. <p>There are no security concerns related to this specification above and beyond those described in the relevant section of <cite>XMPP Core</cite>.</p>
  612. </section1>
  613. <section1 topic='IANA Considerations' anchor='iana'>
  614. <p>This document requires no interaction with &IANA;.</p>
  615. </section1>
  616. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  617. <section2 topic='Protocol Namespaces' anchor='registrar-namespaces'>
  618. <p>The &REGISTRAR; includes the 'jabber:x:data' namespace in its registry of protocol namespaces.</p>
  619. </section2>
  620. <section2 topic='Parameter Values' anchor='registrar-parameters'>
  621. <p>The XMPP Registrar maintains a registry of parameter values related to the 'jabber:x:data' namespace, specifically as defined in &xep0068;; the registry is located at &FORMTYPES;.</p>
  622. </section2>
  623. </section1>
  624. <section1 topic='XML Schema' anchor='schema'>
  625. <p>This schema is descriptive, not normative.</p>
  626. <code><![CDATA[
  627. <?xml version='1.0' encoding='UTF-8'?>
  628. <xs:schema
  629. xmlns:xs=''
  630. targetNamespace='jabber:x:data'
  631. xmlns='jabber:x:data'
  632. elementFormDefault='qualified'>
  633. <xs:annotation>
  634. <xs:documentation>
  635. The protocol documented by this schema is defined in
  636. XEP-0004:
  637. </xs:documentation>
  638. </xs:annotation>
  639. <xs:element name='x'>
  640. <xs:complexType>
  641. <xs:sequence>
  642. <xs:element name='instructions'
  643. minOccurs='0'
  644. maxOccurs='unbounded'
  645. type='xs:string'/>
  646. <xs:element name='title' minOccurs='0' type='xs:string'/>
  647. <xs:element ref='field' minOccurs='0' maxOccurs='unbounded'/>
  648. <xs:element ref='reported' minOccurs='0' maxOccurs='1'/>
  649. <xs:element ref='item' minOccurs='0' maxOccurs='unbounded'/>
  650. </xs:sequence>
  651. <xs:attribute name='type' use='required'>
  652. <xs:simpleType>
  653. <xs:restriction base='xs:NCName'>
  654. <xs:enumeration value='cancel'/>
  655. <xs:enumeration value='form'/>
  656. <xs:enumeration value='result'/>
  657. <xs:enumeration value='submit'/>
  658. </xs:restriction>
  659. </xs:simpleType>
  660. </xs:attribute>
  661. </xs:complexType>
  662. </xs:element>
  663. <xs:element name='field'>
  664. <xs:complexType>
  665. <xs:sequence>
  666. <xs:element name='desc' minOccurs='0' type='xs:string'/>
  667. <xs:element name='required' minOccurs='0' type='empty'/>
  668. <xs:element ref='value' minOccurs='0' maxOccurs='unbounded'/>
  669. <xs:element ref='option' minOccurs='0' maxOccurs='unbounded'/>
  670. </xs:sequence>
  671. <xs:attribute name='label' type='xs:string' use='optional'/>
  672. <xs:attribute name='type' use='optional'>
  673. <xs:simpleType>
  674. <xs:restriction base='xs:NCName'>
  675. <xs:enumeration value='boolean'/>
  676. <xs:enumeration value='fixed'/>
  677. <xs:enumeration value='hidden'/>
  678. <xs:enumeration value='jid-multi'/>
  679. <xs:enumeration value='jid-single'/>
  680. <xs:enumeration value='list-multi'/>
  681. <xs:enumeration value='list-single'/>
  682. <xs:enumeration value='text-multi'/>
  683. <xs:enumeration value='text-private'/>
  684. <xs:enumeration value='text-single'/>
  685. </xs:restriction>
  686. </xs:simpleType>
  687. </xs:attribute>
  688. <xs:attribute name='var' type='xs:string' use='optional'/>
  689. </xs:complexType>
  690. </xs:element>
  691. <xs:element name='option'>
  692. <xs:complexType>
  693. <xs:sequence>
  694. <xs:element ref='value'/>
  695. </xs:sequence>
  696. <xs:attribute name='label' type='xs:string' use='optional'/>
  697. </xs:complexType>
  698. </xs:element>
  699. <xs:element name='value' type='xs:string'/>
  700. <xs:element name='reported'>
  701. <xs:annotation>
  702. <xs:documentation>
  703. When contained in a "reported" element, the "field" element
  704. SHOULD NOT contain a "value" child.
  705. </xs:documentation>
  706. </xs:annotation>
  707. <xs:complexType>
  708. <xs:sequence>
  709. <xs:element ref='field' maxOccurs='unbounded'/>
  710. </xs:sequence>
  711. </xs:complexType>
  712. </xs:element>
  713. <xs:element name='item'>
  714. <xs:complexType>
  715. <xs:sequence>
  716. <xs:element ref='field' maxOccurs='unbounded'/>
  717. </xs:sequence>
  718. </xs:complexType>
  719. </xs:element>
  720. <xs:simpleType name='empty'>
  721. <xs:restriction base='xs:string'>
  722. <xs:enumeration value=''/>
  723. </xs:restriction>
  724. </xs:simpleType>
  725. </xs:schema>
  726. ]]></code>
  727. </section1>
  728. <section1 topic='Changes in Final State' anchor='final-changes'>
  729. <p>The following substantive protocol changes have been made while this specification has been in the Final state:</p>
  730. <ul>
  731. <li>Specified that the 'var' attribute is required for all field types except "fixed", for which the 'var' attribute is optional.</li>
  732. <li>Specified when to advertise support via service discovery.</li>
  733. <li>Removed references to &PRESENCE; stanzas.</li>
  734. </ul>
  735. </section1>
  736. <section1 topic='Changes in Draft State' anchor='draft-changes'>
  737. <p>The following substantive protocol changes were made while this specification was in the Draft state:</p>
  738. <ul>
  739. <li>The &lt;x/&gt; element MAY be included directly in &MESSAGE; and &PRESENCE; stanzas.</li>
  740. <li>The &lt;x/&gt; element MAY contain a &lt;title/&gt; child for forms and results.</li>
  741. <li>The &lt;x/&gt; element MUST possess a 'type' attribute.</li>
  742. <li>A &lt;field/&gt; element MAY be of type='jid-single'.</li>
  743. <li>Results MAY be reported back in &lt;item/&gt; tags.</li>
  744. <li>Results MAY contain a &lt;reported/&gt; element with result set.</li>
  745. <li>The &lt;reported/&gt; fields MAY possess a 'type' attribute to provide hints about how to interact with the data (type='jid-single' being the most useful).</li>
  746. </ul>
  747. </section1>
  748. </xep>