M. Rose Dover Beach Consulting, Inc. February 28, 2008 Writing I-Ds and RFCs using XML (revised) Rose [Page 1] Writing I-Ds and RFCs using XML (revised) February 2008 Abstract This memo presents a technique for using XML (Extensible Markup Language) as a source format for documents in the Internet-Drafts (I-Ds) and Request for Comments (RFC) series. This memo is an upwards-compatible revision to RFC 2629. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 2. Using the DTD to Write I-Ds and RFCs . . . . . . . . . . . . . 4 2.1. XML basics . . . . . . . . . . . . . . . . . . . . . . . . 4 2.2. Front matter . . . . . . . . . . . . . . . . . . . . . . . 6 2.2.1. The title Element . . . . . . . . . . . . . . . . . . 6 2.2.2. The author Element . . . . . . . . . . . . . . . . . . 7 2.2.3. The date Element . . . . . . . . . . . . . . . . . . . 8 2.2.4. Meta Data Elements . . . . . . . . . . . . . . . . . . 8 2.2.5. The abstract Element . . . . . . . . . . . . . . . . . 9 2.2.6. The note Element . . . . . . . . . . . . . . . . . . . 9 2.2.7. Status, Copyright Notice, Table of Contents . . . . . 9 2.2.8. Everything in the Front . . . . . . . . . . . . . . . 11 2.3. The Middle . . . . . . . . . . . . . . . . . . . . . . . . 12 2.3.1. The section Element . . . . . . . . . . . . . . . . . 12 2.3.2. The appendix Element . . . . . . . . . . . . . . . . . 22 2.4. Back matter . . . . . . . . . . . . . . . . . . . . . . . 22 2.4.1. The references Element . . . . . . . . . . . . . . . . 22 2.4.2. Appendices . . . . . . . . . . . . . . . . . . . . . . 23 2.4.3. Copyright Status . . . . . . . . . . . . . . . . . . . 24 3. Processing the XML Source File . . . . . . . . . . . . . . . . 25 3.1. Editing . . . . . . . . . . . . . . . . . . . . . . . . . 25 3.1.1. Checking . . . . . . . . . . . . . . . . . . . . . . . 25 3.2. Converting to Text Format . . . . . . . . . . . . . . . . 26 3.3. Converting to HTML Format . . . . . . . . . . . . . . . . 26 3.4. Searching . . . . . . . . . . . . . . . . . . . . . . . . 26 Appendix A. The rfc Element . . . . . . . . . . . . . . . . . . . 27 Appendix B. The DTD . . . . . . . . . . . . . . . . . . . . . . . 28 Appendix C. Changes from RFC 2629 . . . . . . . . . . . . . . . . 35 Appendix D. Conformance with RFC 2026 or RFC 3667 (Historic) . . 37 Appendix E. Acknowledgements . . . . . . . . . . . . . . . . . . 38 4. Security Considerations . . . . . . . . . . . . . . . . . . . 39 5. References . . . . . . . . . . . . . . . . . . . . . . . . . . 40 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 42 Rose [Page 2] Writing I-Ds and RFCs using XML (revised) February 2008 1. Introduction This memo describes how to write a document for the I-D and RFC series using the Extensible Markup Language [1] (XML). This memo has three goals: 1. To describe a simple XML Document Type Definition (DTD) that is powerful enough to handle the simple formatting requirements of RFC-like documents whilst allowing for meaningful markup of descriptive qualities. 2. To describe software that processes XML source files, including a tool that produces documents conforming to RFC 2223 [2], HTML format, and so on. 3. To provide the proof-of-concept for the first two goals (this memo was written using this DTD and produced using that software). It is beyond the scope of this memo to discuss the political ramifications of using XML as a source format for RFC-like documents. Rather, it is simply noted that adding minimal markup to plain text: o allows the traditional production of textual RFC-like documents using familiar editors; o requires some, albeit minimal, additions to existing software environments; and, o permits information to be organized, searched, and retrieved using both unstructured and structured mechanisms. Rose [Page 3] Writing I-Ds and RFCs using XML (revised) February 2008 2. Using the DTD to Write I-Ds and RFCs We do not provide a formal or comprehensive description of XML. Rather, this section discusses just enough XML to use a Document Type Declaration (DTD) to write RFC-like documents. If you're already familiar with XML, skip to Appendix B to look at the DTD. 2.1. XML basics There are very few rules when writing in XML, as the syntax is (deceptively) simple. There are five terms you'll need to know: 1. An "element" usually refers to a start tag, an end tag, and all the characters in between, e.g., "text and/or nested elements". 2. An "empty element" combines the start tag and the end tag, e.g., "". For readability, I prefer to write this as "" -- both are legal XML. You don't find empty elements in HTML. 3. An "attribute" is part of an element. If present, they occur in the start tag, e.g., "". Of course, they can also appear in empty elements, e.g., "". 4. An "entity" is a textual macro that starts with "&". Usually, you'll only use them whenever you want to put a "&" or a "<" in your text. 5. A "token" is a string of characters. The first character is either a letter or an underscore ("_"). Any characters that follow are either letters, numbers, an underscore, or a period ("."). First, start your source file with an XML declaration, a reference to the DTD, and the rfc element: ... Ignore the first two lines -- the declaration and the reference -- and simply treat them as opaque strings. Nothing else should be Rose [Page 4] Writing I-Ds and RFCs using XML (revised) February 2008 present after the tag. Second, make sure that all elements are properly matched and nested. A properly matched element that starts with "" is eventually followed with "". (Empty elements are always matched.) Elements are properly nested when they don't overlap. For example, ... ... ... is properly nested. However, ... ... ... overlaps, so the elements aren't properly nested. Third, never use "<" or "&" in your text. Instead, use either "<" or "&", respectively. Fourth, there are two quoting characters in XML, apostrophe (') and quotation ("). Make sure that all attributes values are quoted, e.g., "". If the value contains one of the quoting characters, then use the other to quote the value, e.g., "", If the value contains both quoting characters, then use one of them to quote the value, and replace occurrences of that character in the attribute value with either "'" (apostrophe) or """ (quotation), e.g., "". If you want to put a comment in your source file, here's the syntax: Rose [Page 5] Writing I-Ds and RFCs using XML (revised) February 2008 Finally, XML is case sensitive, which means that "" is different from "". 2.2. Front matter Immediately following the tag is the front element: <author ...> <author ...> <date ...> <area ...> <workgroup ...> <keyword ...> <keyword ...> <abstract ...> <note ...> </front> ... </rfc> (Note that in all examples, indentation is used only for expository purposes.) The front element consists of a title element, one or more author elements, a date element, one or more optional area elements, one or more optional workgroup elements, one or more optional keyword elements, an optional abstract element. and, one or more optional note elements. 2.2.1. The title Element The title element identifies the title of the document. Because the title will be used in the headers of the document when formatted according to [2], if the title is more than 42 characters, then an abbreviation should also be provided, e.g., <title abbrev='Much Ado about Nothing'> The IETF's Discussion on "Source Format of RFC Documents" Rose [Page 6] Writing I-Ds and RFCs using XML (revised) February 2008 2.2.2. The author Element Each author element identifies a document author. Since a document may have more than one author, more than one author element may be present. If the author is a person, then three attributes must be present in the tag, initials, surname, and fullname, e.g., There is also an optional role attribute, which, if present, must take the value "editor". The author element itself consists of an organization element, and, an optional address element. The organization element is similar to the title element, in that an abbreviation may be paired with a long organization name using the abbrev attribute, e.g., USC/Information Sciences Institute The address element consists of an optional postal element, an optional phone element, an optional facsimile element, an optional email element, and, an optional uri element. The postal element contains one or more street elements, followed by any combination of city, region (state or province), code (zipcode or postal code), and country elements, e.g., 660 York Street M/S 40 San Francisco CA 94110 US This flexibility is provided to allow for different national formats for postal addresses. Note however, that although the order of the city, region, code, and country elements isn't specified, at most one of each may be present. Regardless, these elements must not be re- ordered during processing by an XML application (e.g., display applications must preserve the ordering of the information contained in these elements). Finally, the value of the country element should be a two-letter code from ISO 3166. Rose [Page 7] Writing I-Ds and RFCs using XML (revised) February 2008 The phone, facsimile, email, and uri elements are simple, e.g., +1 916 555 1234 fred@example.com http://example.com/ 2.2.3. The date Element The date element identifies the publication date of the document. It consists of a month and a year, e.g., The date element also has an optional day attribute. (Actually, due to popular demand, all three attributes are optional.) 2.2.4. Meta Data Elements The front element may contain meta data -- the content of these elements does not appear in printed versions of the document. A document has one or more optional area, workgroup, and keyword elements, e.g., General RFC Beautification Working Group RFC Request for Comments I-D Internet-Draft XML Extensible Markup Language The area elements identify a general category for the document (e.g., one of "Applications", "General", "Internet", "Management", "Operations", "Routing", "Security", "Transport", or "User"), while the workgroup elements identify the IETF working groups that produced the document, and the keyword elements identify useful search terms. Rose [Page 8] Writing I-Ds and RFCs using XML (revised) February 2008 2.2.5. The abstract Element A document may have an abstract element, which contains one or more t elements (Section 2.3.1.1). In general, only a single t element is present, e.g., This memo presents a technique for using XML (Extensible Markup Language) as a source format for documents in the Internet-Drafts (I-Ds) and Request for Comments (RFC) series. 2.2.6. The note Element A document may have one or more note elements, each of which contains one or more t elements (Section 2.3.1.1). There is a mandatory title attribute. In general, the note element contains text from the IESG, e.g., The IESG has something to say. 2.2.7. Status, Copyright Notice, Table of Contents Note that text relating to the memo's status, copyright notice, or table of contents is not included in the document's markup -- this is automatically inserted by an XML application when it produces either a text or HTML version of the document. 2.2.7.1. Conformance with RFC 3978 If an Internet-Draft is being produced, then the ipr attribute should be present in the "" tag at the beginning of the file. The value of the attribute should be one of: "full3978", "noModification3978", or "noDerivatives3978". For the latter two options, an additional attribute, iprExtract, will be consulted. If present, its value is an anchor that is used to cross-reference the section of the document that may be extracted as-is for separate use. Consult [3] for further details. If the Internet-Draft is being submitted to an automated process, then the docName attribute should be present in the tag at the beginning of the file. The value of this attribute contains the document (not file) name associated with this Internet-Draft, e.g., Rose [Page 9] Writing I-Ds and RFCs using XML (revised) February 2008 ... Finally, an xml:lang attribute may be present to indicate that the document is written in some language other than English (for writing things other than RFCs). Rose [Page 10] Writing I-Ds and RFCs using XML (revised) February 2008 2.2.8. Everything in the Front So, putting it all together, we have, e.g., Writing I-Ds and RFCs using XML Slate Construction, Inc.
660 York Street M/S 40 San Francisco CA 94110 US +1 916 555 1234 fred@example.com http://example.com/
General RFC Beautification Working Group RFC Request for Comments I-D Internet-Draft XML Extensible Markup Language This memo presents a technique for using XML (Extensible Markup Language) as a source format for documents in the Internet-Drafts (I-Ds) and Request for Comments (RFC) series.
Rose [Page 11] Writing I-Ds and RFCs using XML (revised) February 2008 2.3. The Middle Note well: Although this draft refers to the appendix element, the text referring to that element is entirely speculative (until such time as this advisory is removed). The middle element contains all the sections of the document except for the bibliography and the boilerplate: ...
... The middle element consists of one or more section elements, optionally followed by one or more appendix elements, optionally followed by one or more section elements. 2.3.1. The section Element Each section element contains a section of the document. There is a mandatory attribute, title, that identifies the title of the section. There are also two optional attributes, anchor, that is used for cross-referencing with the xref element (Section 2.3.1.5), e.g.,
...
and the toc attribute, which is used to indicate whether the section should appear in the table of contents. (The choices are "exclude", "include", and "default"). Rose [Page 12] Writing I-Ds and RFCs using XML (revised) February 2008 The section element is recursive -- each contains any number and combination of t, figure, texttable, iref, and section elements, e.g.,
...
...
...
...
...
...
...
...
...
...
...
...
Note that the section element is tail-recursive. 2.3.1.1. The t Element Paragraphs are contained in t elements. A paragraph can consist of text, lists, figures, and other t element-delimited paragraphs, in any number or combination. If a cross-reference is needed to a section, figure, table, or reference, the xref element (Section 2.3.1.5) is used; similarly, if an external-reference is needed, the eref element (Section 2.3.1.6) is used. Indexing of text is provided by the the iref element (Section 2.3.1.7). Note well: Although RFC2629 allows the figure element to be nested within the t element, authors are strongly encouraged to avoid this usage -- it is always preferable to place the figure element as a direct subordinate of the section element. Rose [Page 13] Writing I-Ds and RFCs using XML (revised) February 2008 2.3.1.2. The list Element The list element contains one or more items. Each item is a t element, allowing for recursion, e.g., The first item. The second item, which contains two bulleted sub-items: The first sub-item. The second sub-item. The list element has an optional attribute, style, having the value "numbers" (for numeric lists), "letters" (for alphabetic lists), "symbols" (for bulleted lists), "hanging" (for hanging lists), "format" (for auto-formatted lists), or, "empty" (for indented text). If a list element is nested, the default value is taken from its closest parent; otherwise, the default value is "empty". When nested within a hanging list element, the t element has an optional attribute, hangText that specifies the text to be inserted, e.g., the "counting designation" is rendered (e.g., "2.1" or "A.2"); the title attribute of the corresponding element is rendered (e.g., "XML Basics"); no additional designation is rendered; or, a suitable designation is rendered, e.g., "Section 2.1" or "<a href='#xml_basics'>XML Basics</a>" (the default). Rose [Page 14] Writing I-Ds and RFCs using XML (revised) February 2008 The style attribute value for an auto-formatted list starts with the seven letters "format ", and is followed by a string which must contain exactly one instance of "%d" and "%c". Hanging text is automatically generated for each nested t element, e.g., Text for R1. Text for R2. ... Text for Directive A. Text for Directive B. ... Text for R3. If the list is auto-formatted, then the optional counter attribute is consulted, which controls the numbering. By default, the value of this attribute is the same as the formatting string, e.g., Text for R1. Text for R2. ... Text for Directive A. Text for Directive B. ... Text for R3. Rose [Page 15] Writing I-Ds and RFCs using XML (revised) February 2008 If the style attribute has the value "hanging" or "format", then a second, optional, attribute called hangIndent is consulted. This overrides the default indentation used for the text of each t element, ensuring that each t element has the same indentation, e.g., Text for R1. Text for R2. ... Text for R12. The final item will read "R12: Text for R12." 2.3.1.3. The figure Element The figure element groups an optional preamble element, an artwork element, and an optional postamble element together. The figure element also has an optional anchor attribute that is used for cross- referencing with the xref element (Section 2.3.1.5). There is also an optional title attribute that identifies the title of the figure. The preamble and postamble elements, if present, are simply text. If a cross-reference is needed to a section, figure, table, or reference, the xref element (Section 2.3.1.5) is used; similarly, if an external-reference is needed, the eref element (Section 2.3.1.6) is used. Indexing of text is provided by the the iref element (Section 2.3.1.7). The artwork element, which must be present, contains "ASCII artwork". Unlike text contained in the t, preamble, or postamble elements, both horizontal and vertical whitespace is significant in the artwork element. Rose [Page 16] Writing I-Ds and RFCs using XML (revised) February 2008 So, putting it all together, we have, e.g.,
So, putting it all together, we have, e.g., ascii artwork goes here... be sure to use "<" or "&" instead of "<" and "&", respectively! which is a very simple example.
which is a very simple example. If you have artwork with a lot of "<" characters, then there's an XML trick you can use:
If you have artwork with a lot of "<" characters, then there's an XML trick you can use: The "<![CDATA[ ... ]]>" construct is called a CDATA block -- everything between the innermost brackets is left alone by the XML application.
The construct is called a CDATA block -- everything between the innermost brackets is left alone by the XML application. Because the figure element represents a logical grouping of text and artwork, an XML application producing a text version of the document should attempt to keep these elements on the same page. Because RFC 2223 [2] allows no more than 69 characters by 49 lines of content on each page, XML applications should be prepared to prematurely introduce page breaks to allow for better visual grouping. Finally, the artwork element has two optional attributes: name and type. The former is used to suggest a filename to use when storing the content of the artwork element, whilst the latter contains a suggestive data-typing for the content. Rose [Page 17] Writing I-Ds and RFCs using XML (revised) February 2008 2.3.1.4. The texttable Element The texttable element groups an optional preamble element, one or more ttcol elements, zero or more c elements, and an optional postamble element together. The texttable element also has an optional anchor attribute that is used for cross-referencing with the xref element (Section 2.3.1.5). There is also an optional title attribute that identifies the title of the table. The preamble and postamble elements have already been described in Section 2.3.1.3. The ttcol element, of which at least one must be present, defines a column header for the table, along with the desired width and alignment for the column: o the optional width attribute, if present, indicates the desired amount of horizontal space taken by the column, and is expressed as a percentage (e.g., "30%"), and the remaining space is divided equally among all columns for which the width is unspecified; and, o the optional align attribute, if present indicates whether the column should be justified to the "left", "center", or "right". The c element, is present for each cell in the table, and contains text along with the usual cross-reference and indexing elements. So, putting it all together, we have, e.g., So, putting it all together, we have, e.g., ttcol #1 ttcol #2 c #1 c #2 c #3 c #4 c #5 c #6 which is a very simple example. which is a very simple example. Rose [Page 18] Writing I-Ds and RFCs using XML (revised) February 2008 So, putting it all together, we have, e.g., +----------+----------+ | ttcol #1 | ttcol #2 | +----------+----------+ | c #1 | c #2 | | | | | c #3 | c #4 | | | | | c #5 | c #6 | +----------+----------+ which is a very simple example. As with the figure element, the texttable element represents a logical grouping of text, hence an XML application producing a text version of the document should attempt to keep these elements on the same page. 2.3.1.5. The xref Element The xref element is used to cross-reference sections, figures, tables, and references. The mandatory target attribute is used to link back to the anchor attribute of the section, figure, and reference elements. The value of the anchor and target attributes should be formatted according to the token syntax in Section 2.1. If used as an empty element, e.g., according to the token syntax in . then the XML application inserts an appropriate phrase during processing. What's "appropriate" depends on the value of the optional format attribute. There are four possible values: counter: the "counting designation" is rendered (e.g., "2.1" or "A.2"); title: the title attribute of the corresponding element is rendered (e.g., "XML Basics"); none: no additional designation is rendered; or, Rose [Page 19] Writing I-Ds and RFCs using XML (revised) February 2008 default: a suitable designation is rendered, e.g., "Section 2.1" or "XML Basics" (the default). If used with content, e.g., conforming to RFC 2223. then the XML application inserts an appropriate designation during processing, such as "RFC 2223[2]" or "RFC 2223". Although the XML application decides what "an appropriate designation" might be, its choice is consistent throughout the processing of the document. 2.3.1.6. The eref Element The eref element is used to reference external documents. The mandatory target attribute is a URI [6], e.g., Cafe con Leche Note that while the target attribute is always present, the eref element may be empty, e.g., and the XML application inserts an appropriate designation during processing such as "[9]" or "http://example.com/". 2.3.1.7. The iref Element The iref element is used to add information to an index, typically rendered at the end of the document. The mandatory item attribute is the primary key the information is stored under, whilst the optional subitem attribute is the secondary key, e.g., The optional primary attribute can be used to indicate that this particular indexing entry should be considered "primary". Finally, note that the iref element is always empty -- it never contains any text. 2.3.1.8. The cref Element The cref element is used to add commentary information to a draft being written, typically rendered at the end of the document. The Rose [Page 20] Writing I-Ds and RFCs using XML (revised) February 2008 element's character data contains the comment, and the optional source attribute can be used for attribute. One or more processing directives are used to indicate whether the commentary information should be rendered, and if so, whether it should be rendered inline or in a separate section at the end of the document. 2.3.1.9. The spanx Element The spanx element, which may occur only inside the t element, is used by the author to provide formatting guidance to the XML application. There is an attribute, style, that indicates how the text inside the element should be rendered. (Note that leading and trailing whitespace is significant.) At this time, the list of possible values for the style isn't enumerated, but implementations should, at a minimum, support: emph: indicates emphasis; strong: indicates stronger emphasis; and, verb: indicates sample input for programs. 2.3.1.10. The vspace Element The vspace element, which may occur only inside the t element, is used by the author to provide formatting guidance to the XML application. There is an attribute, blankLines, that indicates the number of blank lines that should be inserted. A physical linebreak is specified by using the default value, "0". In addition, the vspace element can be used to force a new physical paragraph within a list item, e.g., This is list item. This is part of the same list item, although when displayed, it appears as a separate physical paragraph. An XML application producing a text version of the document should exercise care when encountering a value for blankLines that causes a pagebreak -- in particular, if a vspace element causes a pagebreak, then no further blank lines should be inserted. This allows authors Rose [Page 21] Writing I-Ds and RFCs using XML (revised) February 2008 to "force" a pagebreak by using an arbitrarily large value, e.g., "blankLines='100'". Finally, note that the vspace element is always empty -- it never contains any text. 2.3.2. The appendix Element The appendix element is identical to the the section element (Section 2.3.1). It has the same attributes (the mandatory title and the optional anchor). As with the section element, it is tail-recursive -- each appendix element contains any number and combination of t, figure, texttable, iref, and appendix elements. 2.4. Back matter Finally, the back element is used for references: ...
The back element consists of zero or more references elements, and, one or more optional section elements. The back element itself is optional, if your document doesn't have any references or appendices, you don't have to include it. 2.4.1. The references Element The references element contains the document's bibliography. The optional title attribute defaults to "References", if not present. This element contains one or more reference elements. Each reference element contains a front element, one or more optional seriesInfo elements, one or more optional format elements, and one or more optional annotation elements. We've already discussed the front element back in Section 2.2. Rose [Page 22] Writing I-Ds and RFCs using XML (revised) February 2008 The seriesInfo element has two attributes, name and value that identify the document series and series entry, respectively. The reference element has an optional anchor attribute that is used for cross-referencing with the xref element (Section 2.3.1.5), e.g., Internet Official Protocol Standards USC/Information Sciences Institute The format element has a mandatory type attribute (typically having the value "TXT"), and two optional elements o octets, which indicates the size in octets of the formatted document; and, o target, which is an external to the formatted document. The reference element also has an optional target attribute that is used for external references (c.f., Section 2.3.1.6). The XML application, if producing an HTML version of the document will use the target attribute accordingly; however, if the name attribute of the seriesInfo element has the value "RFC", then the XML application should automatically provide an appropriate default for the target attribute (e.g., "http://example.com/in-notes/rfc2200.txt"). Finally, the annotation element may be used to annotate a citation. Zero or more annotations may be present, and each contains text along with the usual cross-reference and indexing elements. 2.4.2. Appendices To include appendices after the bibliography, simply add more section elements. Rose [Page 23] Writing I-Ds and RFCs using XML (revised) February 2008 2.4.3. Copyright Status The copyright status for the document is not included in the document's markup -- this is automatically inserted by an XML application that produces either a text or HTML version of the document. Rose [Page 24] Writing I-Ds and RFCs using XML (revised) February 2008 3. Processing the XML Source File This section concerns itself with applications that operate on an XML source file. A lot of XML tools are available, as are many lists of XML resources, e.g., Cafe con Leche [9]. There are two kinds of XML tools: validating and non-validating. Both check that the source file conforms to the rules given in Section 2.1. However, in addition to making sure that the source file is well-formed, a validating tool also reads the DTD referenced by the source file to make sure that they match. There are a number of both validating and non-validating tools available. 3.1. Editing There are several XML editors available. Ideally, you want an editor that validates. This has two advantages: o the editor provides guidance in fleshing-out the document structure; and, o the editor validates that the source file matches the rules in the DTD. There are three major modes in Emacs that support XML: nxml [10], tdtd [11], and psgml [12]. The author uses nxml mode, which has a built in XML validator. The psgml mode allows you to validate the source file (by calling an external program). If you visit the source file in Emacs and the major mode isn't "SGML" or "XML", then usually all it takes is adding these lines to your ".emacs" file: (setq auto-mode-alist (cons (cons "\\.xml$" 'sgml-mode) auto-mode-alist)) and then restarting Emacs. If this doesn't work, try one of the sources above. The author uses both sgml-mode in Emacs, and a commercial validating editor, XML Spy [13], when editing source files. 3.1.1. Checking If your editor doesn't validate, then you should run a program to validate the source file. The author uses the AlphaWorks XML parser [14] for this purpose. It requires that your system have a Java virtual machine. In addition to Java, there are validating parsers written in C, Perl, Python, and Rose [Page 25] Writing I-Ds and RFCs using XML (revised) February 2008 Tcl. 3.2. Converting to Text Format The author has written the xml2rfc tool [15], which reads the source file and produces both text, HTML, and nroff versions of the document. (This memo was produced using the xml2rfc tool.) The xml2rfc tool doesn't validate; however, a web-based service is also available at the same location, which runs a validator prior to invoking the tool. 3.3. Converting to HTML Format Extensible Style Language [7] (XSLT) is used to describe transformations from the source file into some other structured file. So, you can use an XSLT-capable formatter to convert an XML source file to HTML. Julian Reschke has written an XSLT file [16] for the format described in this memo. It requires one of the MSXML, Saxon, or Xalan extensions to XSLT. For example, by including the line: after the XML declaration in your source file, IE6 will render the file as HTML. 3.4. Searching As with text editors, any text-oriented search tool (e.g., grep) can be used on the source file. However, there are search tools available that understand structured source. The author uses sgrep version 1.9 [17] for this purpose, e.g. sgrep -g xml 'ELEMENTS("title") not in ELEMENTS("back")' \ writing-rfcs.xml which extracts the title element from the source file. Rose [Page 26] Writing I-Ds and RFCs using XML (revised) February 2008 Appendix A. The rfc Element The tag at the beginning of the file, with only an ipr attribute (Section 2.2.7.1), produces an Internet-Draft. However, when other attributes are added to this tag by the RFC editor, an RFC is produced, e.g., At a minimum, the number attribute should be present. The other attributes are: o obsoletes, having a comma-separated list of RFC numbers, that the document obsoletes; o updates, having a comma-separated list of RFC numbers, that the document updates; o category, having one of these values: 1. "std", for a Standards-Track document; 2. "bcp", for a Best Current Practices document; 3. "exp", for an Experimental Protocol document; 4. "historic", for a historic document; or, 5. "info", the default, for an Informational document. o seriesNo, having the corresponding number in the STD ("std"), BCP ("bcp"), or FYI ("info") series. Finally, a special entity, "&rfc.number;", is available. Authors preparing an RFC should use this entity whenever they want to reference the number of the RFC within the document itself. In printed versions of the document, the appropriate substitution (or "XXXX") will occur. Rose [Page 27] Writing I-Ds and RFCs using XML (revised) February 2008 Appendix B. The DTD %rfc2629-xhtml; %rfc2629-other; Rose [Page 30] Writing I-Ds and RFCs using XML (revised) February 2008 Rose [Page 31] Writing I-Ds and RFCs using XML (revised) February 2008 Rose [Page 33] Writing I-Ds and RFCs using XML (revised) February 2008 Rose [Page 34] Writing I-Ds and RFCs using XML (revised) February 2008 Appendix C. Changes from RFC 2629 The following changes were made from the format originally defined in RFC 2629 [8]: o New elements: * spanx * texttable, ttcol, and c * annotation * cref o New choices for enumerated attributes: rfc ipr: "full3978", "noModification3978", and "noDerivatives3978" list style: "letters" list style: formatted (starts with "format") o Previously mandatory attributes, now optional: date: month, year o New, optional attributes: rfc: xml:lang, iprextract author: role section: toc list: hangIndent (when "hanging" or formatted) list: counter (when formatted) figure: suppress-title artwork: name, type references: title Rose [Page 35] Writing I-Ds and RFCs using XML (revised) February 2008 xref: format iref: primary o Content model changes: section: is now tail-recursive references: may occur more than once in the back element (e.g., for normative and non-normative references) format: may occur zero or more times in the reference element figure: should not appear within a t element iref: may appear directly within section and figure elements Rose [Page 36] Writing I-Ds and RFCs using XML (revised) February 2008 Appendix D. Conformance with RFC 2026 or RFC 3667 (Historic) If an Internet-Draft is being produced in conformance with RFC 2026 or RFC 3667, then the ipr attribute should be present in the "" tag at the beginning of the file, and the value of the attribute should be one of: full2026: indicating that the document is in full conformance with all the provisions of Section 10 of RFC 2026; noDerivativeWorks2026: indicating that the document is in full conformance with all the provisions of Section 10 of RFC 2026 except that the right to produce derivative works is not granted none: indicating that the document is NOT offered in accordance with Section 10 of RFC 2026, and the author does not provide the IETF with any rights other than to publish as an Internet-Draft; full3667: indicating that the document conforms with Section 5.1 of RFC 3667; noModification3667: indicating that the document conforms with Sections 5.1 and 5.2(a) of RFC 3667; or, noDerivatives3667: indicating that the document conforms with Sections 5.1 and 5.2(b) of RFC 3667. In the "none" case, a copyright notice will not be automatically inserted during processing by an XML application. Consult [4] and [5] for further details. Rose [Page 37] Writing I-Ds and RFCs using XML (revised) February 2008 Appendix E. Acknowledgements The author gratefully acknowledges the contributions of: Alan Barrett, Steven M. Bellovin, Scott Brim, Brad Burdick, Brian Carpenter, Steve Deering, Patrik Faltstrom, Jim Gettys, Charles Levert, Henrik Levkowetz, Carl Malamud, Chris Newman, Julian Reschke, Kurt Starsinic, and, Frank Strauss. Rose [Page 38] Writing I-Ds and RFCs using XML (revised) February 2008 4. Security Considerations According to [2], your document should contain a section near the end that discusses the security considerations of the protocol or procedures that are the main topic of your document, e.g., ...
According to , your document should contain a section near the end that discusses the security considerations of the protocol or procedures that are the main topic of your document.
The name attribute of the artwork element allows an author to suggest a filename to use when storing the element's content. Any software processing this attribute must ensure that if it uses this filename that its contents will not be stored or interpreted, without the user explicitly initiating that action. Accordingly, implementors must be aware to the potential hazards on their target systems. Rose [Page 39] Writing I-Ds and RFCs using XML (revised) February 2008 5. References [1] Paoli, J., Maler, E., Bray, T., and C. Sperberg-McQueen, "Extensible Markup Language (XML) 1.0 (Second Edition)", World Wide Web Consortium FirstEdition REC-xml-20001006, October 2000, . [2] Postel, J. and J. Reynolds, "Instructions to RFC Authors", RFC 2223, October 1997. [3] Bradner, S., "IETF Rights in Contributions", BCP 78, RFC 3978, March 2005. [4] Bradner, S., "The Internet Standards Process -- Revision 3", BCP 9, RFC 2026, October 1996. [5] Bradner, S., "IETF Rights in Contributions", RFC 3667, February 2004. [6] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifiers (URI): Generic Syntax", RFC 2396, August 1998. [7] Clark, J., "XSL Transformations (XSLT) Version 1.0", World Wide Web Consortium Recommendation REC-xslt-19991116, November 1999, . [8] Rose, M., "Writing I-Ds and RFCs using XML", RFC 2629, June 1999. [9] [10] [11] [12] [13] [14] [15] [16] [17] Rose [Page 40] Writing I-Ds and RFCs using XML (revised) February 2008 Index I indexing how to 20 Rose [Page 41] Writing I-Ds and RFCs using XML (revised) February 2008 Author's Address Marshall T. Rose Dover Beach Consulting, Inc. POB 255268 Sacramento, CA 95865-5268 US Phone: +1 916 483 8878 Email: mrose@dbc.mtview.ca.us Rose [Page 42]