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-0143.xml 31KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. <!ENTITY SOURCECONTROL "&lt;<link url='http://xmpp.org/about-xmpp/xsf/xsf-source-control/'>http://xmpp.org/about-xmpp/xsf/xsf-source-control/</link>&gt;" >
  5. %ents;
  6. ]>
  7. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  8. <xep>
  9. <header>
  10. <title>Guidelines for Authors of XMPP Extension Protocols</title>
  11. <abstract>This document provides information intended to assist authors of XMPP Extension Protocols.</abstract>
  12. &LEGALNOTICE;
  13. <number>0143</number>
  14. <status>Active</status>
  15. <type>Procedural</type>
  16. <sig>Standards</sig>
  17. <approver>Council</approver>
  18. <dependencies>
  19. <spec>XEP-0001</spec>
  20. </dependencies>
  21. <supersedes/>
  22. <supersededby/>
  23. <shortname>N/A</shortname>
  24. &stpeter;
  25. <revision>
  26. <version>1.1.2</version>
  27. <date>2016-12-02</date>
  28. <initials>psa</initials>
  29. <remark><p>Reflect preference for GitHub pull requests to maintain existing XEPs; update terminology to refer to XMPP Extensions Editor team.</p></remark>
  30. </revision>
  31. <revision>
  32. <version>1.1.1</version>
  33. <date>2016-08-27</date>
  34. <initials>egp</initials>
  35. <remark><p>Reflect the split of extensions/ into a separate xeps repository.</p></remark>
  36. </revision>
  37. <revision>
  38. <version>1.1</version>
  39. <date>2011-07-08</date>
  40. <initials>psa</initials>
  41. <remark><p>Added section about maintaining a XEP; updated the text to reflect migration from Subversion to git for source control; mentioned best practice for table usage and use of PDF for publication.</p></remark>
  42. </revision>
  43. <revision>
  44. <version>1.0</version>
  45. <date>2004-12-09</date>
  46. <initials>psa</initials>
  47. <remark><p>Per a vote of the XMPP Council, advanced status to Active.</p></remark>
  48. </revision>
  49. <revision>
  50. <version>0.4</version>
  51. <date>2004-10-22</date>
  52. <initials>psa</initials>
  53. <remark><p>Further clarifications.</p></remark>
  54. </revision>
  55. <revision>
  56. <version>0.3</version>
  57. <date>2004-10-12</date>
  58. <initials>psa</initials>
  59. <remark><p>Minor clarifications throughout.</p></remark>
  60. </revision>
  61. <revision>
  62. <version>0.2</version>
  63. <date>2004-09-16</date>
  64. <initials>psa</initials>
  65. <remark><p>Described document metadata elements.</p></remark>
  66. </revision>
  67. <revision>
  68. <version>0.1</version>
  69. <date>2004-09-15</date>
  70. <initials>psa</initials>
  71. <remark><p>Initial version.</p></remark>
  72. </revision>
  73. </header>
  74. <section1 topic='Introduction' anchor='intro'>
  75. <p>The &XSF; receives a significant number of proposals for defining extensions to the core XMPP protocols specified in &xmppcore;. However, it is not always clear to authors how to best structure a proposal in order for it to be accepted as an XMPP Extension Protocol (XEP) and then advance through the XSF's standards process. Therefore, this document provides guidelines that are intended to help authors write better XMPP Extension Protocol specifications.</p>
  76. <p>These guidelines assume that the reader is familiar with the XEP series of documents and the processes for handling them within the XSF, as defined in &xep0001;.</p>
  77. </section1>
  78. <section1 topic='Before You Submit a Proposal' anchor='prep'>
  79. <p>A prospective author is strongly encouraged to complete some research before submitting a proposal for consideration as a XEP. In particular, the author should do the following:</p>
  80. <ul>
  81. <li>Review the XMPP RFCs and Experimental, Active, Draft, and Final XEPs to determine if the proposed protocol extension is truly needed in order to fill a gap in existing XMPP technologies and protocols.</li>
  82. <li>Review rejected and deferred XEPs, as well as proposals that were never accepted (see &lt;<link url='http://xmpp.org/extensions/inbox/'>http://xmpp.org/extensions/inbox/</link>&gt;) to determine if similar extensions have been proposed in the past but not approved by the &COUNCIL;.</li>
  83. <li>Review protocols developed within other standards development organizations, such as the &IETF; and &W3C;, to determine if they might be more appropriate than a new XMPP extension.</li>
  84. <li>Review discussions within the &SSIG; to determine if similar functionality has been discussed in the past or is currently under discussion.</li>
  85. </ul>
  86. <p>After completing this research, the prospective author might conclude that a new protocol extension is needed. If so, the author is strongly advised to do the following:</p>
  87. <ol>
  88. <li>Review <cite>XEP-0001</cite> and the &xep0134;.</li>
  89. <li>Understand the <link url='#submit'>Submission Process</link>.</li>
  90. <li>Become familiar with the <link url='#format'>XEP XML Format</link>.</li>
  91. <li>Then and only then write a proposal that includes all of the appropriate <link url='#sections'>Sections of a XEP</link>.</li>
  92. <li>Review the content to ensure that it conforms to the <link url='#styleguide'>XEP Styleguide</link>.</li>
  93. </ol>
  94. </section1>
  95. <section1 topic='Submitting a Proposal' anchor='submit'>
  96. <p>The process for submitting a proposal for consideration as a XEP is straightforward:</p>
  97. <ol>
  98. <li>Write your proposal following the guidelines described in this document.</li>
  99. <li>Make sure that you read, understand, and agree to the &XSFIPR; before you submit your proposal.</li>
  100. <li>Send your XML file (or a URL pointing to the file) to the &EDITOR; team via email to editor@xmpp.org (make sure that the email subject includes the string "XEP" somewhere in it!)..</li>
  101. </ol>
  102. </section1>
  103. <section1 topic='Maintaining a XEP' anchor='maintain'>
  104. <p>If your proposal is accepted as a XEP, you will probably need to update the specification periodically to incorporate feedback as well as implementation and deployment experience. The XMPP Extensions Editor team will assign a XEP number to your document and add it to source control.</p>
  105. <p>The XMPP Extensions Editor team prefers that you work as follows:</p>
  106. <ol>
  107. <li>Create your own fork of the XSF's git repository (the address of the GitHub mirror can be found at &SOURCECONTROL;).</li>
  108. <li>Create a dedicated branch for these changes in your forked repository.</li>
  109. <li>Make your desired changes to the document or documents, including an updated &lt;revision/&gt; element as described below.</li>
  110. <li>Commit and push the changes to your branch.</li>
  111. <li>Create a pull request from your fork to the master branch at the GitHub mirror.</li>
  112. </ol>
  113. <p>The XMPP Extensions Editor team will then process your pull request, seek Council approval if necessary, and publish an updated version of your XEP.</p>
  114. <p>NOTE: As explained in <cite>XEP-0001</cite>, updated versions of XEPs in the Experimental state are published without the need for approval by the XMPP Council. However, updated versions of XEPs in the Active, Draft, or Final state must be approved by the XMPP Council to ensure proper change control regarding approved protocols.</p>
  115. </section1>
  116. <section1 topic='XEP XML Format' anchor='format'>
  117. <p>The XEP XML format is substantially similar to a reduced set of XHTML. This is intentional: it makes it easier to author XEPs. In fact, if you use the template file with its associated XSLT stylesheet, you should be able to view your proposal in most modern web browsers (see below). The following subsections explain how to get started with XEP authoring and describe the XML format used for XEPs (see the xep.xsd or xep.dtd file for a formal description).</p>
  118. <section2 topic='Working with XEP Files' anchor='format-work'>
  119. <p>The best way to start working on your proposal is to retrieve all of the existing XEP files and associated stylesheets from source control. These files are stored using the git system as described at &SOURCECONTROL;. The document structure is formally defined by both a DTD and an XML schema, but you do not need to understand the formal descriptions in order to author a XEP. In addition, a handy template file is included as the 'xep-template.xml' file in the 'extensions' directory, providing a quick starting point for XEP authoring.</p>
  120. <p>To create your proposal, do a git clone of the 'xeps' repository, go to the 'xeps/' directory you just cloned (e.g., 'cd xeps'), copy the template file (e.g., 'cp xep-template.xml xep-foo.xml'), and start editing the file using either a basic text editor or a specialized XML editing application such as XML Spy or XMLmind.</p>
  121. <p>Even if you use a basic text editor, you should be able to view your document in most modern web browsers as an XML file as long as you have xep.xsl and xep.dtd in the 'xeps' directory. Because of inconsistencies in browser XSLT implementations, certain formatting (e.g., table layouts and the numbering of tables, examples, and footnotes) might not be perfect. Don't panic; it will look fine in the HTML output produced by the XMPP Extensions Editor team. If your XML file doesn't render at all (i.e., it's just one big text blob), you are using a bad browser. If you see only the bare outline generated by xep.xsl but none of your text, you have an error in your XML. You can check your XML syntax at xml.com <note>&lt;<link url="http://www.xml.com/pub/a/tools/ruwf/check.html">http://www.xml.com/pub/a/tools/ruwf/check.html</link>&gt;</note>.</p>
  122. <p>To programatically convert your XML file into HTML, we recommend using Daniel Veillard's <link url='http://xmlsoft.org/XSLT/'>xsltproc</link> program, which will give you helpful error messages regarding XML syntax problems. However, the XMPP Extensions Editor team will complete the final rendering of XML into HTML as well as posting of your HTML file to www.xmpp.org, so you do not need to generate HTML files for submission to the XMPP Extensions Editor team (in fact, the XMPP Extensions Editor team requires that you submit your proposal in the XEP XML format, not HTML).</p>
  123. <p>Finally, the xep.ent file contains convenient "external entities" that provide shortcuts for including references to XMPP Extension Protocols, RFCs, and other common strings. Unfortunately, most browsers do not correctly process external entities, so you cannot include entities from xep.ent if you need to view your XML source file in a browser. However, the XMPP Extensions Editor team reserves the right to convert your markup to external entities, since it makes their life easier. Also, please do not add items to the xep.ent file; instead, add them as inline entities within your document and then ask the XMPP Extensions Editor team to add them to the xep.ent file.</p>
  124. </section2>
  125. <section2 topic='File Metadata' anchor='format-metadata'>
  126. <p>This section describes the metadata elements contained in the &lt;header/&gt; element of a XEP file (see below for the file contents).</p>
  127. <p>The XML character data of the &lt;title/&gt; element is the title of your XEP. Choose a descriptive title that is less than ten words long. The XMPP Extensions Editor team may change this in consultation with the author.</p>
  128. <p>The XML character data of the &lt;abstract/&gt; element SHOULD be one or two sentences that capture the essence of your proposal (usually beginning "This specification defines an XMPP protocol extension that..."). The XMPP Extensions Editor team has been known to modify the abstract so that it accurately describes the proposal.</p>
  129. <p>The XML character data of the &lt;legal/&gt; element MUST be as defined in the XSF IPR Policy and reflected in both the xep.ent file and the XEP template.</p>
  130. <p>The XML character data of the &lt;number/&gt; element SHOULD be "xxxx"; this will be changed to the next sequential XEP number by the XMPP Extensions Editor team if the XMPP Council accepts the proposal as an XMPP Extension Protocol.</p>
  131. <p>The XML character data of the &lt;status/&gt; element SHOULD be "ProtoXEP" since all proposals start out as "proto-XEPs"; this will be changed to "Experimental" if the XMPP Council accepts the proposal as an XMPP Extension Protocol.</p>
  132. <p>The XML character data of the &lt;type/&gt; element SHOULD be either "Standards Track" or "Informational" (there are also Historical, Humorous, and Procedural XEPs, but these are uncommon and usually written by the XMPP Extensions Editor team). A Standards Track XEP defines an XMPP extension intended to be used as a common part of XMPP technologies. An Informational XEP defines best practices or a usage profile related to XMPP or an XMPP Extension Protocol (e.g., &xep0175;).</p>
  133. <p>The XML character data of the &lt;approver/&gt; element SHOULD be "Council".</p>
  134. <p>The &lt;dependencies/&gt; element is used to specify RFCs, XMPP Extension Protocols, and other specifications on which your proposal depends in a normative fashion (i.e., specifications that MUST or SHOULD be understood in order to implement your proposed protocol). Each specification MUST be identified by a distinct &lt;spec/&gt; child element (see existing XEP specifications for clues regarding document identifiers, or consult with the XMPP Extensions Editor team).</p>
  135. <p>The &lt;supersedes/&gt;, &lt;supersededby/&gt;, &lt;shortname/&gt;, and &lt;schemaloc/&gt; elements are for use by the XMPP Extensions Editor team; however, if your document supersedes an existing XMPP Extension Protocol, feel free to include a &lt;spec/&gt; child element specifying the document identifier (e.g., <cite>XEP-0093</cite>) for the protocol that is being superseded.</p>
  136. <p>Include one &lt;author/&gt; element for each co-author. Note well that the &lt;firstname/&gt; and &lt;surname/&gt; elements are REQUIRED per <cite>XEP-0001</cite>, as is some combination of the &lt;email/&gt;, &lt;jid/&gt;, and &lt;uri/&gt; elements so that appropriate contact information is available.</p>
  137. <p>Include one &lt;revision/&gt; element for each revision of your document. The XML character data of the &lt;version/&gt; element SHOULD be "0.0.1" for your initial submission to the XMPP Extensions Editor team, and the &lt;remark/&gt; SHOULD be "First draft."; for each revision, you will include another &lt;revision/&gt; element (place it <em>before</em> the existing &lt;revision/&gt; elements) and iterate the &lt;version/&gt; element (e.g., "0.0.2" after "0.0.1" or "0.10" after "0.9"). The format for the &lt;date/&gt; element is yyyy-mm-dd.</p>
  138. </section2>
  139. <section2 topic='File Contents' anchor='format-contents'>
  140. <p>Aside from the metadata in the &lt;header/&gt; element (see above), a XEP file is a series of sections, arranged in a hierarchy (&lt;section1/&gt; is a top-level section, within which you can nest &lt;section2/&gt; sections, and so on down to &lt;section4/&gt;). The title of a section is captured in the 'topic' attribute. You should also include an 'anchor' attribute so that you can link to page fragments from within your document. The allowable elements within a section element probably look familiar from XHTML: &lt;p/&gt; for paragraphs, &lt;ol/&gt; and &lt;ul/&gt; for ordered and unordered lists, and so on.</p>
  141. <p>The &lt;example/&gt; and &lt;code/&gt; elements are used to show protocol snippets; the &lt;example/&gt; element SHOULD possess a 'caption' attribute that describes the example, whereas the &lt;code/&gt; element does not. Define an XML CDATA section within both of these elements so that you do not need to escape the '&lt;' and '&gt;' characters in your sample XML stanzas, since this makes life much easier for author and editor alike (see the markup in existing XEP specifications).</p>
  142. <p>The &lt;p/&gt; and &lt;li/&gt; elements can also contain more markup that is familiar from XHTML, such as the &lt;img/&gt; element. Note that hyperlinks are of the form &lt;link url='foo'&gt;bar&lt;/link&gt; rather than &lt;a href='foo'&gt;bar&lt;/a&gt; (the reasons for this are lost in the mists of time and it is too late to change it now, so you'll just have to adjust). If needed, you can also use inline structural and presentational markup such as &lt;em/&gt;, &lt;strong/&gt;, &lt;tt/&gt;, &lt;cite/&gt;, and &lt;span/&gt; within the &lt;p/&gt; and &lt;li/&gt; elements. </p>
  143. <p>You may also include tables (these are helpful for listing error codes and such). The &lt;table/&gt; element SHOULD possess a 'caption' attribute that describes the table's contents. Standard XHTML table structure applies (&lt;tr/&gt; defines a row, which contains &lt;th/&gt; elements for header rows and &lt;td/&gt; elements for data rows), and the 'colspan' and 'rowspan' attributes are also available if you need them. Table presentation (such as cellpadding and cellspacing) is handled by the XSLT and CSS stylesheets. However keep in mind that tables weren't meant to display a huge amount of text.</p>
  144. <p>The xep.xsl file performs all sorts of magic in converting your XML file into HTML, including creation of the front matter, table of contents, section numbering, notes, and revision history. Feel free to submit patches for this file, but do not commit your modified version to source control.</p>
  145. <p>Although HTML is the primary publishing format for XEPs, since 2009 the XMPP Extensions Editor team has also published XEPs in the form of PDF file. Keeping that in mind, try to avoid tables with too many columns, which might require wider paper than is normal.</p>
  146. </section2>
  147. </section1>
  148. <section1 topic='The Sections of a XEP Document' anchor='sections'>
  149. <p>Most XEP specifications will have most of the following sections, usually in something like the order shown. Other sections may be appropriate (e.g., &xep0071; has a section for W3C Considerations). Use your best judgment regarding the sections you need in order to make your argument, or consult with the XMPP Extensions Editor team regarding your needs.</p>
  150. <section2 topic='Introduction' anchor='sections-intro'>
  151. <p>The introduction to a XEP document is quite important since it provides the rationale for considering the proposal. In particular, the introduction SHOULD include information such as the following:</p>
  152. <ol>
  153. <li>Tasks that users currently cannot complete because we are lacking the protocol you propose. (Note: Users are not just IM users, but any person, system, or application that could gain value from interacting with other entities over XMPP networks.)</li>
  154. <li>Other projects or protocols and how XMPP technologies could interface with them because of your proposed protocol (e.g., XML-RPC, SOAP).</li>
  155. <li>A comparison between XMPP technologies and "the competition" (e.g., other IM systems or messaging protocols) describing holes in the XMPP protocol stack that need to be filled in order to offer similar functionality.</li>
  156. <li>The relevant history of thinking within the XMPP community.</li>
  157. <li>Real-world examples of problems the protocol can solve.</li>
  158. </ol>
  159. </section2>
  160. <section2 topic='Requirements' anchor='sections-reqs'>
  161. <p>Every XEP document SHOULD include a section describing the requirements being addressed by the document. This information is critically important, because it clearly defines the scope of the proposal as well as any relevant constraints on the protocol design.</p>
  162. </section2>
  163. <section2 topic='Glossary' anchor='sections-glossary'>
  164. <p>If your XEP document uses terms that may not be familiar to the reader, please define them in a glossary.</p>
  165. <p>The preferred layout for a glossary is a definition list using the HTML &lt;dl&gt; tag (see existing XEPs for examples).</p>
  166. </section2>
  167. <section2 topic='Use Cases' anchor='sections-usecases'>
  168. <p>It is recommended that document authors structure their proposals according to the use cases that the proposal will address. <note>A good introduction to use cases may be found at &lt;<link url="http://www.pols.co.uk/usecasezone/">http://www.pols.co.uk/usecasezone/</link>&gt;.</note> We have found that use cases force authors to focus on functionality rather than "protocol for the sake of protocol". It is also helpful to sort use cases by actor, as is done in &xep0045;, for example. Include one subsection for each use case.</p>
  169. <p>When writing use cases and the associated protocols, make sure to:</p>
  170. <ul>
  171. <li>Clearly define the success scenarios, alternate flows, and possible errors.</li>
  172. <li>Describe the expected behavior of XMPP clients, servers, and components when using this protocol.</li>
  173. <li>Include lots of protocol examples. <note>Our mantra is: "We put the example in example.com!"</note></li>
  174. </ul>
  175. <p>We repeat: include lots of protocol examples. Examples help not only implementers but also those who will review your proposal in the Standards SIG and XMPP Council. You get extra credit with the XMPP Extensions Editor team if you follow Jabber tradition by using characters and situations from the plays of Shakespeare:</p>
  176. <example caption='An Example from Shakespeare'><![CDATA[
  177. <message
  178. from='juliet@capulet.com/balcony'
  179. to='romeo@montague.net/garden'
  180. type='chat'>
  181. <body>Wherefore art thou, Romeo?</body>
  182. </message>
  183. ]]></example>
  184. </section2>
  185. <section2 topic='Error Codes' anchor='sections-errors'>
  186. <p>If your proposal defines a number of error and status codes (as is done in <cite>XEP-0045</cite>), it is a good idea to include a table of all the codes defined in your document.</p>
  187. </section2>
  188. <section2 topic='Business Rules' anchor='sections-bizrules'>
  189. <p>You may want to include a section describing various business rules (essentially, a variety of MUSTs, SHOULDs, and MAYs regarding application behavior). This is not required but can be helpful to implementers.</p>
  190. </section2>
  191. <section2 topic='Implementation Notes' anchor='sections-impl'>
  192. <p>You may want to include a section devoted to implementation notes. Again, this is not required but can be helpful to implementers.</p>
  193. </section2>
  194. <section2 topic='Internationalization Considerations' anchor='sections-i18n'>
  195. <p>If there are any internationalization or localization issues related to your proposal (e.g., whether to include the 'xml:lang' attribute), define them in this optional section.</p>
  196. </section2>
  197. <section2 topic='Security Considerations' anchor='sections-security'>
  198. <p>Your proposal MUST include a section entitled "Security Considerations". Even if there are no security features or concerns related to your proposal, you MUST note that fact. For helpful guidelines, refer to &rfc3552;; the core XMPP specification (<cite>RFC 6120</cite>) also includes a very thorough security considerations section that can be used as an examplar.</p>
  199. </section2>
  200. <section2 topic='IANA Considerations' anchor='sections-iana'>
  201. <p>This section is REQUIRED. The IANA is &IANA;, the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. Most proposals do not require interaction with the IANA, in which case the text of this section SHOULD read "This document requires no interaction with the Internet Assigned Numbers Authority (IANA)." If your proposal requires interaction with the IANA, discuss the matter with the XMPP Extensions Editor team in their role as the XMPP Registrar. Do not contact the IANA on your own!</p>
  202. </section2>
  203. <section2 topic='XMPP Registrar Considerations' anchor='sections-registrar'>
  204. <p>This section is REQUIRED. The &REGISTRAR; maintains a list of reserved XMPP protocol namespaces as well as registries of parameters used in the context of protocols approved by the XMPP Standards Foundation. If your proposal does not require interaction with the XMPP Registrar, the text of this section SHOULD read "No namespaces or parameters need to be registered with the XMPP Registrar as a result of this document." Refer to Draft or Final XEPs for appropriate text in other cases, or consult with the XMPP Extensions Editor team in their role as the XMPP Registrar.</p>
  205. </section2>
  206. <section2 topic='XML Schema' anchor='sections-schema'>
  207. <p>An XML Schema is required in order for protocols to be approved by the XMPP Council. The XMPP Extensions Editor team can assist you in defining an XML Schema for the protocol you are proposing.</p>
  208. </section2>
  209. <section2 topic='Acknowledgements' anchor='sections-ack'>
  210. <p>Most XEP documents end with a section thanking non-authors who have made significant contributions or who have provided feedback regarding the specification.</p>
  211. </section2>
  212. </section1>
  213. <section1 topic='XEP Styleguide' anchor='styleguide'>
  214. <p>XMPP Extension Protocols are written in English. It is not expected that you will be a fine prose writer, but try to write in a clear, easily-understood fashion. The XMPP Extensions Editor team will correct any errors of grammar, spelling <note>With all due respect to authors in other parts of the world, XMPP Extension Protocols follow American spelling conventions; thus "authorisation" will be changed to "authorization" and such.</note>, punctuation, and usage they may find in your proposal, but might not do so until your proposal is in the XMPP Council's queue for advancement to Draft or Active. In addition, the XMPP Extensions Editor team reserves the right to improve phrases that are unclear or infelicitous, move sections around, modify examples to use Shakespearean characters, and otherwise improve the argument and logical flow of your proposal (naturally, without changing the meaning).</p>
  215. <p>The following styleguide is provided to supplement the standard English styleguides, such as <cite>The Elements of Style</cite> <note>See &lt;<link url='http://en.wikipedia.org/wiki/The_Elements_of_Style'>http://en.wikipedia.org/wiki/The_Elements_of_Style</link>&gt;.</note> and <cite>The Chicago Manual of Style</cite> <note>See &lt;<link url='http://en.wikipedia.org/wiki/The_Chicago_Manual_of_Style'>http://en.wikipedia.org/wiki/The_Chicago_Manual_of_Style</link>&gt;.</note>; please refer to those resources for information about common English (especially American English) usage and to this styleguide for XEP-specific guidelines.</p>
  216. <section2 topic='Attributes' anchor='style-attr'>
  217. <p>When talking about an attribute by name, refer to it in single quotes. Example: the 'to' attribute.</p>
  218. <p>When talking about the value of an attribute, refer to it in double quotes. Example: the value of the 'subscription' attribute is "both".</p>
  219. <p>Elements <em>possess</em> attributes and <em>contain</em> character data and/or child elements; do not confuse these terms.</p>
  220. </section2>
  221. <section2 topic='Code Examples' anchor='style-ex'>
  222. <p>In examples, use single quotes rather than double quotes; they are more readable.</p>
  223. <p>To show the hierarchy of XML elements, indent two spaces for every level.</p>
  224. <p>If an element possesses multiple attributes, please show them in the order dictated by &w3canon;.</p>
  225. <p>If an element possesses a large number of attributes, include a line break before each attribute and indent them so that they are vertically aligned for readability.</p>
  226. <p>If the XML character data of an element is long, include line breaks and indent by two spaces.</p>
  227. <p>Examples are the major source of right-scrolling in our HTML output files. Right-scrolling is evil. Therefore, adjust your example layouts accordingly (line widths should be no more than 110 characters or so).</p>
  228. <p>Example:</p>
  229. <code><![CDATA[
  230. <iq from='darkcave@macbeth.shakespeare.lit'
  231. id='config1'
  232. to='crone1@shakespeare.lit/desktop'
  233. type='result'>
  234. <query xmlns='http://jabber.org/protocol/muc#roomconfig'>
  235. <x xmlns='jabber:x:data' type='form'>
  236. <title>Configuration for "darkcave" Room</title>
  237. <instructions>
  238. Please complete this form to make changes to the configuration
  239. of your room; to add room owners and administrators, use the
  240. appropriate room commands rather than this form.
  241. </instructions>
  242. <field type='hidden' var='FORM_TYPE'>
  243. <value>http://jabber.org/protocol/muc#roomconfig</value>
  244. </field>
  245. </query>
  246. </iq>
  247. ]]></code>
  248. <p>Some examples include strings that are the output of a hashing algorithm such as SHA-1 (see &rfc3174;) or SHA-256 (see &xep0300;). An easy way to generate these is to use the <link url='http://www.openssl.org/'>OpenSSL</link> "dgst" command to generate the hash. For example, the following command will generate the SHA-1 hash "9f5f9fdab9da7fc12e3c52b258acbcb4bb8e66ac":</p>
  249. <code>
  250. echo -n 'bard@shakespeare.lit' | openssl dgst -hex -sha1
  251. </code>
  252. <p>Some examples (e.g., SASL examples) include strings that are encoded using Base64 (see &rfc4648;). An easy way to generate these is to use the <link url='http://www.openssl.org/'>OpenSSL</link> "enc" command to generate the base64-encoded equivalent. For example, the following command will generate the base64-encoded string "YmFyZEBzaGFrZXNwZWFyZS5saXQ=":</p>
  253. <code>
  254. echo -n 'bard@shakespeare.lit' | openssl enc -nopad -base64
  255. </code>
  256. </section2>
  257. <section2 topic='Conformance Terms' anchor='style-conf'>
  258. <p>Conformance terms (e.g,, "MUST" and "SHOULD") are specified in RFC 2119. Use them. When such terms are not in ALL CAPS, the special conformance sense does not apply (although it is preferable to use terms such as 'might' instead of 'may' and 'ought' instead of 'should').</p>
  259. </section2>
  260. <section2 topic='Elements' anchor='style-elem'>
  261. <p>When talking about an element by name, refer to it as an empty XML element. Example: the &lt;query/&gt; element.</p>
  262. <p>The top-level &MESSAGE;, &PRESENCE;, and &IQ; elements are actually XML stanzas (see <cite>RFC 6120</cite>); please refer to them as stanzas, not elements.</p>
  263. <p>Elements <em>possess</em> attributes and <em>contain</em> character data and/or child elements; do not confuse these terms.</p>
  264. <p>Do not use the term "tag" when you mean "element".</p>
  265. <p>Do not add a possessive to the element itself. Negative example: the &lt;body/&gt;'s character data. Positive example: the &lt;body/&gt; element's character data.</p>
  266. <p>Note: There are shortcuts for stanza names and some common element names in the xep.ent file.</p>
  267. </section2>
  268. <section2 topic='Errors' anchor='style-err'>
  269. <p>When talking about an error condition, use the XML element names defined in <cite>RFC 6120</cite> rather than the old HTTP-style code numbers. Example: the &lt;feature-not-implemented/&gt; error.</p>
  270. <p>Note: There are shortcuts for the stanza errors in the xep.ent file.</p>
  271. </section2>
  272. <section2 topic='Namespaces' anchor='style-ns'>
  273. <p>When talking about a namespace by name, refer to it in single quotes. Example: the 'jabber:iq:roster' namespace.</p>
  274. <p>An element or attribute is <em>qualified by</em> (rather than "scoped by" or "in") a particular namespace.</p>
  275. </section2>
  276. <section2 topic='Quotes' anchor='style-quot'>
  277. <p>For precision, the XSF places all punctuation outside the quotation marks unless one is quoting text that includes the punctuation (this is known as "logical punctuation"). Example: the port used for client communications is "5222".</p>
  278. </section2>
  279. </section1>
  280. <section1 topic='Acknowledgements' anchor='ack'>
  281. <p>Thanks to Tobias Markmann and Kevin Smith for their input.</p>
  282. </section1>
  283. </xep>