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-0122.xml 26KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  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 Validation</title>
  10. <abstract>This specification defines a backwards-compatible extension to the XMPP Data Forms protocol that enables applications to specify additional validation guidelines related to a form, such as validation of standard XML datatypes, application-specific datatypes, value ranges, and regular expressions.</abstract>
  11. &LEGALNOTICE;
  12. <number>0122</number>
  13. <status>Draft</status>
  14. <type>Standards Track</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>xdata-validate</shortname>
  23. <schemaloc>
  24. <url>http://www.xmpp.org/schemas/xdata-validate.xsd</url>
  25. </schemaloc>
  26. <registry/>
  27. &linuxwolf;
  28. <revision>
  29. <version>1.0.2</version>
  30. <date>2018-03-21</date>
  31. <initials>fs</initials>
  32. <remark>Remove text about element emptiness.</remark>
  33. </revision>
  34. <revision>
  35. <version>1.0.1</version>
  36. <date>2018-03-05</date>
  37. <initials>fs</initials>
  38. <remark>Move normative language from footnote into text.</remark>
  39. </revision>
  40. <revision>
  41. <version>1.0</version>
  42. <date>2004-09-22</date>
  43. <initials>psa</initials>
  44. <remark>Per a vote of the Jabber Council, advanced status to Draft.</remark>
  45. </revision>
  46. <revision>
  47. <version>0.8</version>
  48. <date>2004-09-20</date>
  49. <initials>lw</initials>
  50. <remark>Synchronized descriptive text with schema.</remark>
  51. </revision>
  52. <revision>
  53. <version>0.7</version>
  54. <date>2004-08-23</date>
  55. <initials>lw</initials>
  56. <remark>Replaced method attribute with dedicated elements; removed Formal Definition section in favor of defining requirements within the use-cases and XML schema; included display considerations; added reference to XEP-0115.</remark>
  57. </revision>
  58. <revision>
  59. <version>0.6</version>
  60. <date>2004-07-23</date>
  61. <initials>lw/psa</initials>
  62. <remark>Replaced &lt;text-list/&gt; with specific interpretations for other validation methods; Further clarified use of validation methods (other than "basic") with "list-single", "list-multi", and "text-multi"; Fixed errors in some examples; initial datatype registrations.</remark>
  63. </revision>
  64. <revision>
  65. <version>0.5</version>
  66. <date>2004-05-27</date>
  67. <initials>lw</initials>
  68. <remark>Added &lt;text-list/&gt; ("text as a list") support; Clarified &lt;list-range/&gt; expanded discussion on datatype registries.</remark>
  69. </revision>
  70. <revision>
  71. <version>0.4</version>
  72. <date>2004-01-29</date>
  73. <initials>lw</initials>
  74. <remark>Removed "std" datatypes; Added references to XML Schema built-in datatypes.</remark>
  75. </revision>
  76. <revision>
  77. <version>0.3</version>
  78. <date>2003-12-10</date>
  79. <initials>lw</initials>
  80. <remark>Added "open" method; Added "list-range" validation.</remark>
  81. </revision>
  82. <revision>
  83. <version>0.2</version>
  84. <date>2003-10-15</date>
  85. <initials>lw</initials>
  86. <remark>Added consideration about "unvalidated" submits; Reworked introduction.</remark>
  87. </revision>
  88. <revision>
  89. <version>0.1</version>
  90. <date>2003-10-06</date>
  91. <initials>lw</initials>
  92. <remark>Initial version.</remark>
  93. </revision>
  94. </header>
  95. <section1 topic='Introduction' anchor='intro'>
  96. <p>&xep0004; ("x:data") provides a simple and interoperable way to request and present information for both applications and humans. However, the simple nature of "x:data" requires the form interpreter at times to guess as to exactly what type of information is being requested or provided. This document builds upon "x:data" to provide this additional validation.</p>
  97. </section1>
  98. <section1 topic='Requirements' anchor='reqs'>
  99. <p>The requirements for this document are:</p>
  100. <ul>
  101. <li>Backwards compatible with the existing "x:data" protocol.</li>
  102. <li>Provide extended datatypes (such as dates, times, and numbers).</li>
  103. <li>Allow for multiple validation methods.</li>
  104. <li>Allow for user-defined datatypes.</li>
  105. <li>Accommodate value ranges.</li>
  106. <li>Accommodate regular expression matching.</li>
  107. </ul>
  108. </section1>
  109. <section1 topic='Use Cases' anchor='usecases'>
  110. <p>This document defines a new namespace, "http://jabber.org/protocol/xdata-validate". The root element for this namespace is &lt;validate/&gt;, and MUST be contained within a &lt;field/&gt; element (qualified by the 'jabber:x:data' namespace) for each <cite>Data Forms</cite> field that possesses additional validation information.</p>
  111. <section2 topic='Datatype Validation' anchor='usecases-datatypes'>
  112. <p>The simplest usage is to provide a more-granular datatype for a &lt;field/&gt; element used in <cite>Data Forms</cite>. To provide this datatype information, a &lt;validate/&gt; element is included whose 'datatype' attribute specifies the data type of any &lt;value/&gt; contained within the &lt;field/&gt; element:</p>
  113. <example caption='Field with extended datatype'><![CDATA[
  114. <field var='evt.date' type='text-single' label='Event Date/Time'>
  115. <validate xmlns='http://jabber.org/protocol/xdata-validate'
  116. datatype='xs:dateTime'/>
  117. <value>2003-10-06T11:22:00-07:00</value>
  118. </field>
  119. ]]></example>
  120. <p>The preceding example demonstrates a field that is expected to contain a date/time value.</p>
  121. <p>The 'datatype' attribute specifies the datatype. This attribute is OPTIONAL, and defaults to "xs:string". It MUST meet one of the following conditions:</p>
  122. <ul>
  123. <li>Start with "xs:", and be one of the "built-in" datatypes defined in &w3xmlschema2;</li>
  124. <li>Start with a prefix registered with the &REGISTRAR;</li>
  125. <li>Start with "x:", and specify a user-defined datatype.</li>
  126. </ul>
  127. <p>Note that while "x:" allows for ad-hoc definitions, its use is NOT RECOMMENDED.</p>
  128. </section2>
  129. <section2 topic='Validation Methods' anchor='usecases-validation'>
  130. <p>In addition to datatypes, the validation method can also be provided. The method is specified via a child element. The validation methods defined in this document are:</p>
  131. <ul>
  132. <li>&lt;basic/&gt; for validation only against the datatype itself</li>
  133. <li>&lt;open/&gt; for open-ended validation against the datatype</li>
  134. <li>&lt;range/&gt; for validation against a given min/max and the datatype</li>
  135. <li>&lt;regex/&gt; for validation against a given regular expression and the datatype</li>
  136. </ul>
  137. <p>If no validation method is specified, form processors MUST assume &lt;basic/&gt; validation. The &lt;validate/&gt; element SHOULD include one of the above validation method elements, and MUST NOT include more than one.</p>
  138. <p>Any validation method applied to a field of type "list-multi", "list-single", or "text-multi" (other than &lt;basic/&gt;) MUST imply the same behavior as &lt;open/&gt;, with the additional constraints defined by that method.</p>
  139. <section3 topic='&lt;basic/&gt; Validation' anchor='usercases-validation.basic'>
  140. <p>Building upon the earlier example, to indicate that the value(s) should simply match the field type and datatype constraints, the &lt;validate/&gt; element shall contain a &lt;basic/&gt; child element.</p>
  141. <example caption='Basic validation'><![CDATA[
  142. <field var='evt.date' type='text-single' label='Event Date/Time'>
  143. <validate xmlns='http://jabber.org/protocol/xdata-validate'
  144. datatype='xs:dateTime'>
  145. <basic/>
  146. </validate>
  147. <value>2003-10-06T11:22:00-07:00</value>
  148. </field>
  149. ]]></example>
  150. <p>Using &lt;basic/&gt; validation, the form interpreter MUST follow the validation rules of the datatype (if understood) and the field type.</p>
  151. </section3>
  152. <section3 topic='&lt;open/&gt; Validation' anchor='usercases-validation.open'>
  153. <p>For "list-single" or "list-multi", to indicate that the user may enter a custom value (matching the datatype constraints) or choose from the predefined values, the &lt;validate/&gt; element shall contain an &lt;open/&gt; child element:</p>
  154. <example caption='Open validation'><![CDATA[
  155. <field var='evt.category'
  156. type='list-single'
  157. label='Event Category'>
  158. <validate xmlns='http://jabber.org/protocol/xdata-validate'
  159. datatype='xs:string'>
  160. <open/>
  161. </validate>
  162. <option><value>holiday</value></option>
  163. <option><value>reminder</value></option>
  164. <option><value>appointment</value></option>
  165. </field>
  166. ]]></example>
  167. <p>The &lt;open/&gt; validation method applies to "text-multi" differently; it hints that each value for a "text-multi" field shall be validated separately. This effectively turns "text-multi" fields into an open-ended "list-multi", with no options and all values automatically selected.</p>
  168. </section3>
  169. <section3 topic='&lt;range/&gt; Validation' anchor='usercases-validation.range'>
  170. <p>To indicate that the value should fall within a certain range, the &lt;validate/&gt; element shall contain a &lt;range/&gt; child element:</p>
  171. <example caption='Range validation'><![CDATA[
  172. <field var='evt.date' type='text-single' label='Event Date/Time'>
  173. <validate xmlns='http://jabber.org/protocol/xdata-validate'
  174. datatype='xs:dateTime'>
  175. <range min='2003-10-05T00:00:00-07:00'
  176. max='2003-10-24T23:59:59-07:00'/>
  177. </validate>
  178. <value>2003-10-06T11:22:00-07:00</value>
  179. </field>
  180. ]]></example>
  181. <p>The 'min' and 'max' attributes of the &lt;range/&gt; element specify the minimum and maximum values allowed, respectively.</p>
  182. <p>The 'max' attribute specifies the maximum allowable value. This attribute is OPTIONAL. The value depends on the datatype in use.</p>
  183. <p>The 'min' attribute specifies the minimum allowable value. This attribute is OPTIONAL. The value depends on the datatype in use.</p>
  184. <p>The &lt;range/&gt; element SHOULD possess either a 'min' or 'max' attribute, and MAY possess both. If neither attribute is included, the processor MUST assume that there are no range constraints.</p>
  185. </section3>
  186. <section3 topic='&lt;regex/&gt; Validation' anchor='usercases-validatoin.regex'>
  187. <p>To indicate that the value should be restricted to a regular expression, the &lt;validate/&gt; element shall contain a &lt;regex/&gt; child element:</p>
  188. <example caption='Regular expression validation'><![CDATA[
  189. <field var='ssn' type='text-single' label='Social Security Number'>
  190. <desc>This field should be your SSN, including '-' (e.g. 123-12-1234)</desc>
  191. <validate xmlns='http://jabber.org/protocol/xdata-validate'
  192. datatype='xs:string'>
  193. <regex>([0-9]{3})-([0-9]{2})-([0-9]{4})</regex>
  194. </validate>
  195. </field>
  196. ]]></example>
  197. <p>The XML character data of this element is the pattern to apply. The syntax of this content MUST be that defined for POSIX extended regular expressions<note>The "best" definition of this syntax can be found in the <link url='http://www.gsp.com/cgi-bin/man.cgi?section=7&amp;topic=re_format'>re_format(7) man page</link></note>, including support for Unicode<note>Guidelines for adapting regular expressions to support Unicode is defined at <link url='http://www.unicode.org/reports/tr18/'>http://www.unicode.org/reports/tr18/</link></note>.</p>
  198. <p>The &lt;regex/&gt; element MUST contain character data only.</p>
  199. </section3>
  200. </section2>
  201. <section2 topic='Selection Ranges in "list-multi"' anchor='usecases-ranges'>
  202. <p>For "list-multi", validation can indicate (via the &lt;list-range/&gt; element) that a minimum and maximum number of options should be selected and/or entered. This selection range MAY be combined with the other methods to provide more flexibility.</p>
  203. <example caption='Selection Range validation'><![CDATA[
  204. <field var='evt.notify-methods'
  205. type='list-multi'
  206. label='Notify me by'>
  207. <validate xmlns='http://jabber.org/protocol/xdata-validate'
  208. datatype='xs:string'>
  209. <basic/>
  210. <list-range min='1' max='3'/>
  211. </validate>
  212. <option><value>e-mail</value></option>
  213. <option><value>jabber/xmpp</value></option>
  214. <option><value>work phone</value></option>
  215. <option><value>home phone</value></option>
  216. <option><value>cell phone</value></option>
  217. </field>
  218. ]]></example>
  219. <p>The &lt;list-range/&gt; element SHOULD be included only when the &lt;field/&gt; is of type "list-multi" and SHOULD be ignored otherwise.</p>
  220. <p>The 'max' attribute specifies the maximum allowable number of selected/entered values. This attribute is OPTIONAL. The value MUST be a positive integer.</p>
  221. <p>The 'min' attribute specifies the minimum allowable number of selected/entered values. This attribute is OPTIONAL. The value MUST be a positive integer.</p>
  222. <p>The &lt;list-range/&gt; element SHOULD possess either a 'min' or 'max' attribute, and MAY possess both. If neither attribute is included, the processor MUST assume that there are no selection constraints.</p>
  223. </section2>
  224. </section1>
  225. <section1 topic='Implementation Notes' anchor='impl'>
  226. <section2 topic='Required to Support' anchor='impl-req'>
  227. <p>At a minimum, implementations MUST support the following:</p>
  228. <ul>
  229. <li>Datatype validation</li>
  230. <li>The &lt;basic/&gt; validation method</li>
  231. </ul>
  232. <p>If an implementation does not understand the specified datatype, it MUST validate according to the default "xs:string" datatype. If an implementation does not understand the specified method, it MUST validate according to the &lt;basic/&gt; method.</p>
  233. </section2>
  234. <section2 topic='Namespacing' anchor='impl-ns'>
  235. <p>While all elements associated with this document MUST be qualified by the 'http://jabber.org/protocol/xdata-validate' namespace, explicitly declaring the default namespace for each instance can be overly verbose. However, Jabber/XMPP implementations have historically been very lax regarding namespacing, thus requiring some careful use of prefixes.</p>
  236. <p>The use of namespace prefixes is RECOMMENDED for large forms, to reduce the data size. To maintain the highest level of compatibility, implementations sending the form using prefixes SHOULD use the namespace prefix "xdv", and SHOULD declare the namespace prefix mapping in the ancestor &lt;x xmlns='jabber:x:data'/&gt; element:</p>
  237. <example caption='Example of recommended namespace prefixing'><![CDATA[
  238. <x xmlns='jabber:x:data'
  239. xmlns:xdv='http://jabber.org/protocol/xdata-validate'
  240. type='form'>
  241. <title>Sample Form</title>
  242. <instructions>
  243. Please provide information for the following fields...
  244. </instructions>
  245. <field type='text-single' var='name' label='Event Name'/>
  246. <field type='text-single' var='date/start' label='Starting Date'>
  247. <xdv:validate datatype='xs:date'>
  248. <basic/>
  249. </xdv:validate>
  250. </field>
  251. <field type='text-single' var='date/end' label='Ending Date'>
  252. <xdv:validate datatype='xs:date'>
  253. <basic/>
  254. </xdv:validate>
  255. </field>
  256. </x>
  257. ]]></example>
  258. </section2>
  259. <section2 topic='Internationalization/Localization' anchor='impl-i18n'>
  260. <p>This document relies on the internationalization/localization mechanisms provided by &xmppcore;. As much as possible, all datatype formats MUST be locale-independent.</p>
  261. </section2>
  262. <section2 topic='Form Submissions' anchor='impl-submit'>
  263. <p>Form processors MUST NOT assume that a form with validation has actually been validated when submitted. There is no realistic expectation that form interpreters honor validation.</p>
  264. </section2>
  265. <section2 topic='Existing Protocols' anchor='impl-proto'>
  266. <p>While this document is compatible with the existing "x:data" definition, form providers SHOULD first determine support for it, using either &xep0115; if presence-aware or &xep0030;. This is especially important for limited-connection and/or limited-capabilities devices, such as cell phones.</p>
  267. </section2>
  268. <section2 topic='Display Considerations' anchor='impl-display'>
  269. <p>Although primarily intended for validating form submission, validation MAY have an impact on display, and MAY be applied to data forms that are not submitted (e.g. 'result' type forms). The following table outlines which field types a particular validation method is or is not appropriate for, and how a display SHOULD interpret the validation methods if considered<note>If a particular field type is not listed, the display MAY include validation support, but is not expected to do so.</note>:</p>
  270. <table caption='Validation Methods and Field Types'>
  271. <tr>
  272. <th>Validation Method</th>
  273. <th>SHOULD be Allowed</th>
  274. <th>SHOULD NOT be Allowed</th>
  275. <th>Display Suggestions</th>
  276. </tr>
  277. <tr>
  278. <td>basic</td>
  279. <td><ul>
  280. <li>fixed</li>
  281. <li>list-multi</li>
  282. <li>list-single</li>
  283. <li>text-multi</li>
  284. <li>text-single</li>
  285. </ul></td>
  286. <td><ul>
  287. <li>hidden</li>
  288. <li>jid-multi</li>
  289. <li>jid-single</li>
  290. </ul></td>
  291. <td>Display the datatype appropriate to the locale</td>
  292. </tr>
  293. <tr>
  294. <td>open</td>
  295. <td><ul>
  296. <li>jid-multi</li>
  297. <li>jid-single</li>
  298. <li>list-multi</li>
  299. <li>list-single</li>
  300. <li>text-multi</li>
  301. <li>text-single</li>
  302. </ul></td>
  303. <td><ul>
  304. <li>hidden</li>
  305. </ul></td>
  306. <td>Display the datatype appropriate to the locale. For "text-multi" treat each value as a discrete entry (e.g. a user-entered list). For "list-multi" or "list-single", allow user to add/remove entries to select.</td>
  307. </tr>
  308. <tr>
  309. <td>range</td>
  310. <td><ul>
  311. <li>text-single</li>
  312. </ul></td>
  313. <td><ul>
  314. <li>hidden</li>
  315. <li>jid-multi</li>
  316. <li>list-multi</li>
  317. <li>text-multi</li>
  318. </ul></td>
  319. <td>Display the datatype appropriate to the locale. For "text-single", allow user to increment/decrement through possible values. For "text-multi" treat each value as a discrete entry (e.g. a user-entered list). For "list-multi" or "list-single", allow user to add/remove entries to select.</td>
  320. </tr>
  321. <tr>
  322. <td>regex</td>
  323. <td><ul>
  324. <li>text-single</li>
  325. </ul></td>
  326. <td><ul>
  327. <li>hidden</li>
  328. <li>jid-multi</li>
  329. <li>list-multi</li>
  330. <li>text-multi</li>
  331. </ul></td>
  332. <td>Display the datatype appropriate to the locale. If possible, display a valid example. For "text-multi" treat each value as a discrete entry (e.g. a user-entered list). For "list-multi" or "list-single", allow user to add/remove entries to select.</td>
  333. </tr>
  334. </table>
  335. </section2>
  336. <section2 topic='Validation Ranges' anchor='impl-ranges'>
  337. <p>The &lt;range/&gt; validation method MUST be used only with datatypes that have finite quantities. Within the standard datatype set, it MUST NOT be used with "xs:string".</p>
  338. </section2>
  339. </section1>
  340. <section1 topic='Security Considerations' anchor='sec'>
  341. <p>This document introduces no security concerns above and beyond those specified in <cite>XEP-0004: Data Forms</cite>.</p>
  342. </section1>
  343. <section1 topic='IANA Considerations' anchor='iana'>
  344. <p>This document requires no interaction with &IANA;.</p>
  345. </section1>
  346. <section1 topic='XMPP Registrar Considerations' anchor='registar'>
  347. <section2 topic='Protocol Namespaces' anchor='registar-ns'>
  348. <p>The XMPP Registrar includes 'http://jabber.org/protocol/xdata-validate' in its registry of protocol namespaces.</p>
  349. </section2>
  350. <section2 topic='Registries' anchor='registar-reg'>
  351. <section3 topic='Datatype Prefixes Registry' anchor='registar-reg-prefixes'>
  352. <p>The XMPP Registrar maintains a registry of datatype prefixes used in the context of Data Forms Validation (see &XDVPREFIXES;), where each prefix denotes a group of related datatypes.</p>
  353. <section4 topic='Process' anchor='registrar-reg-prefixes-process'>
  354. &REGPROCESS;
  355. <code><![CDATA[
  356. <datatype-prefix>
  357. <prefix>the prefix token (e.g., "xs")</prefix>
  358. <desc>a natural-language description of the datatype family</desc>
  359. <doc>the document in which datatype family is specified</doc>
  360. </datatype-prefix>
  361. ]]></code>
  362. <p>The registrant may register more than one prefix at a time, each contained in a separate &lt;datatype-prefix/&gt; element.</p>
  363. </section4>
  364. <section4 topic='Initial Submission' anchor='registrar-reg-prefixes-init'>
  365. <p>As part of this document, the following datatype prefixes shall be registered:</p>
  366. <code><![CDATA[
  367. <datatype-prefix>
  368. <prefix>x</prefix>
  369. <desc>An ad-hoc datatype</desc>
  370. <doc>XEP-0122</doc>
  371. </datatype-prefix>
  372. <datatype-prefix>
  373. <prefix>xs</prefix>
  374. <desc>A "standard" datatype as defined in XML Schema Part 2</desc>
  375. <doc>XML Schema Part 2</doc>
  376. </datatype-prefix>
  377. ]]></code>
  378. </section4>
  379. </section3>
  380. <section3 topic='Datatypes Registry' anchor='registar-reg-datatypes'>
  381. <p>The XMPP Registrar maintains a registry of datatypes used in the context of Data Forms Validation (see &XDVTYPES;), where each datatype name includes the relevant prefix (e.g., "xs:anyURI").</p>
  382. <section4 topic='Process' anchor='registrar-reg-datatypes-process'>
  383. &REGPROCESS;
  384. <code><![CDATA[
  385. <datatype>
  386. <name>the full datatype name (e.g., "xs:string")</name>
  387. <desc>a natural-language description of the datatype</desc>
  388. <methods>the validation methods that may apply to the datatype</methods>
  389. <min>the minimum value for the datatype (if any)</min>
  390. <max>the maximum value for the datatype (if any)</max>
  391. </datatype>
  392. ]]></code>
  393. <p>The registrant may register more than one datatype at a time, each contained in a separate &lt;datatype/&gt; element.</p>
  394. </section4>
  395. <section4 topic='Initial Submission' anchor='registrar-reg-datatypes-init'>
  396. <p>The following submission contains the built-in datatypes defined in <cite>XML Schema Part 2</cite> that are deemed mostly like to be useful in the context of the Data Forms protocol; additional datatypes defined therein, as well as other datatypes not defined in XML Schema Part 2, may be registered via separate submissions in the future.</p>
  397. <code><![CDATA[
  398. <datatype>
  399. <name>xs:anyURI</name>
  400. <desc>a Uniform Resource Identifier Reference (URI)</desc>
  401. <methods>basic regex</methods>
  402. <min>N/A</min>
  403. <max>N/A</max>
  404. </datatype>
  405. <datatype>
  406. <name>xs:byte</name>
  407. <desc>an integer with the specified min/max</desc>
  408. <methods>basic range</methods>
  409. <min>-128</min>
  410. <max>127</max>
  411. </datatype>
  412. <datatype>
  413. <name>xs:date</name>
  414. <desc>a calendar date</desc>
  415. <methods>basic range regex</methods>
  416. <min>N/A</min>
  417. <max>N/A</max>
  418. </datatype>
  419. <datatype>
  420. <name>xs:dateTime</name>
  421. <desc>a specific instant of time</desc>
  422. <methods>basic range regex</methods>
  423. <min>N/A</min>
  424. <max>N/A</max>
  425. </datatype>
  426. <datatype>
  427. <name>xs:decimal</name>
  428. <desc>an arbitrary-precision decimal number</desc>
  429. <methods>basic range</methods>
  430. <min>none</min>
  431. <max>none</max>
  432. </datatype>
  433. <datatype>
  434. <name>xs:double</name>
  435. <desc>an IEEE double-precision 64-bit floating point type</desc>
  436. <methods>basic range</methods>
  437. <min>none</min>
  438. <max>none</max>
  439. </datatype>
  440. <datatype>
  441. <name>xs:int</name>
  442. <desc>an integer with the specified min/max</desc>
  443. <methods>basic range</methods>
  444. <min>-2147483648</min>
  445. <max>2147483647</max>
  446. </datatype>
  447. <datatype>
  448. <name>xs:integer</name>
  449. <desc>a decimal number with no fraction digits</desc>
  450. <methods>basic range</methods>
  451. <min>none</min>
  452. <max>none</max>
  453. </datatype>
  454. <datatype>
  455. <name>xs:language</name>
  456. <desc>a language identifier as defined by RFC 1766</desc>
  457. <methods>basic regex</methods>
  458. <min>N/A</min>
  459. <max>N/A</max>
  460. </datatype>
  461. <datatype>
  462. <name>xs:long</name>
  463. <desc>an integer with the specified min/max</desc>
  464. <methods>basic range</methods>
  465. <min>-9223372036854775808</min>
  466. <max>9223372036854775807</max>
  467. </datatype>
  468. <datatype>
  469. <name>xs:short</name>
  470. <desc>an integer with the specified min/max</desc>
  471. <methods>basic range</methods>
  472. <min>-32768</min>
  473. <max>32767</max>
  474. </datatype>
  475. <datatype>
  476. <name>xs:string</name>
  477. <desc>a character strings in XML</desc>
  478. <methods>basic regex</methods>
  479. <min>N/A</min>
  480. <max>N/A</max>
  481. </datatype>
  482. <datatype>
  483. <name>xs:time</name>
  484. <desc>an instant of time that recurs every day</desc>
  485. <methods>basic range regex</methods>
  486. <min>N/A</min>
  487. <max>N/A</max>
  488. </datatype>
  489. ]]></code>
  490. </section4>
  491. </section3>
  492. </section2>
  493. </section1>
  494. <section1 topic='XML Schema' anchor='schema'>
  495. <code><![CDATA[
  496. <?xml version='1.0' encoding='UTF-8'?>
  497. <xs:schema
  498. xmlns:xs='http://www.w3.org/2001/XMLSchema'
  499. targetNamespace='http://jabber.org/protocol/xdata-validate'
  500. xmlns='http://jabber.org/protocol/xdata-validate'
  501. elementFormDefault='qualified'>
  502. <xs:element name='validate'>
  503. <xs:complexType>
  504. <xs:sequence>
  505. <xs:choice minOccurs='0' maxOccurs='1'>
  506. <xs:element ref='basic'/>
  507. <xs:element ref='open'/>
  508. <xs:element ref='range'/>
  509. <xs:element ref='regex'/>
  510. </xs:choice>
  511. <xs:element ref='list-range' minOccurs='0' maxOccurs='1'/>
  512. </xs:sequence>
  513. <xs:attribute name='datatype'
  514. type='xs:string'
  515. use='optional'
  516. default='xs:string'/>
  517. </xs:complexType>
  518. </xs:element>
  519. <xs:element name='basic' type='empty'/>
  520. <xs:element name='open' type='empty'/>
  521. <xs:element name='range'>
  522. <xs:complexType>
  523. <xs:simpleContent>
  524. <xs:extension base='empty'>
  525. <xs:attribute name='min' use='optional'/>
  526. <xs:attribute name='max' use='optional'/>
  527. </xs:extension>
  528. </xs:simpleContent>
  529. </xs:complexType>
  530. </xs:element>
  531. <xs:element name='regex' type='xs:string'/>
  532. <xs:element name='list-range'>
  533. <xs:complexType>
  534. <xs:simpleContent>
  535. <xs:extension base='empty'>
  536. <xs:attribute name='min'
  537. type='xs:unsignedInt'
  538. use='optional'/>
  539. <xs:attribute name='max'
  540. type='xs:unsignedInt'
  541. use='optional'/>
  542. </xs:extension>
  543. </xs:simpleContent>
  544. </xs:complexType>
  545. </xs:element>
  546. <xs:simpleType name='empty'>
  547. <xs:restriction base='xs:string'>
  548. <xs:enumeration value=''/>
  549. </xs:restriction>
  550. </xs:simpleType>
  551. </xs:schema>
  552. ]]></code>
  553. </section1>
  554. </xep>