| Internet-Draft | xml2rfc FAQ | February 2019 |
| Russo | Expires 23 August 2019 | [Page] |
This is a list of frequently asked questions regarding xml2rfc. Please send questions or corrections to thexml2rfc mailing list.¶
Note: this FAQ is for version 3 of xml2rfc; the vocabulary has been changed significantly from version 2. For guidance on version 2, please see theFAQ for xml2rfc v2.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is athttps://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 5 August 2019.¶
Copyright (c) 2019 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.¶
xml2rfc is a tool that lets you convert an XML source file into a text, HTML,nroff, or expanded XML file. It is available fromxml2rfc.ietf.org [xml2rfc] asa web-based service or for download. Version 3 of the tool adds newfeatures and will be used by the RFC Editor to create RFCs. Thecurrent version is here:¶
It's an easy way to create an Internet-Draft in the properformat. It handles boilerplate text and reference text. The HTMLand PDF output formats have new features (such as including SVG figures and non-ASCIIcharacters), and the source file can be used for metadataextraction. Also, the RFC Editor will make use of your source file.(For background, see theRFC Format FAQ.)¶
You need the essentials. XML uses start and end tags, which are nested and matching, and they are case-sensitive. Seethe section "XML basics" of[Writing I-Ds and RFCs using XML (revised)] formore details.¶
not yet updated--AR¶
You have several choices when getting started with xml2rfc, such as:¶
not yet updated--AR¶
Several templates are availablefromhttp://tools.ietf.org/tools/templates [templates]. Theyinclude templates for a generic draft (e.g., draft-davies-template-bare.xml), as well as for a draftcontaining a MIB (e.g., mib-doc-template-xml.txt).¶
not yet updated--AR¶
Sure. We recommend copying the front matter from a template or the XML source of an existing document, thengoing from there. Put <t> tags around paragraphs, and<figure><artwork> tags around figures. Use <![CDATA[ ... ]]> for blocks ofcode or figures that contain <. (SeeWhat is CDATA for? for more information.)¶
For references, replace [RFC2119] with <xref/>.For cross-references to sections, replace Section 9 with<xref/> (if Section 9 has anchor="sec_cons"). SeeUsing References for more information.¶
rfc element to create an Internet-Draft?Use thecategory attribute to indicate the intended category of your draft, wherestd is Standards Track,info is Informational,exp is Experimental,bcp is Best Current Practice, andhistoric is Historic.¶
Use thesubmissionType attribute to indicate the intendeddocument stream, where the value can beIETF,IAB,IRTF, orindependent.¶
SeeSection A.1 of [RFC7991]¶
Use the docName attribute to indicate the filename.¶
If the document potentially updates or obsoletes any RFCs, use theupdates and obsoletes attributes to indicate the relevant RFCnumbers. For Internet-Drafts, this information will be displayed inthe header, followed by "(if approved)".¶
For example, putting it together:¶
<rfc category="info" submissionType="IETF" ipr="trust200902" docName="draft-ietf-wgname-topic-00" updates="1234, 1235" obsoletes="1236" sortRefs="true">¶
Note: The attributes number and seriesNo will be added by the RFC Editor if your draft is approved for publication as an RFC.¶
Note: Some features that used to be processing instructions (in v2) are now attributes of the rfc element (in v3) -- for example,sortRefs andsymRefs.¶
not yet updated--AR¶
At the top, if there is the PI <?rfc strict="yes"?>, then xml2rfc istrying to enforce I-D nits and DTD validity.¶
If you are getting "This file does not begin with an XML declaration",have you entered the filename correctly? It can indicate a problem withthe first line (<?xml version="1.0">) or it can mean "File notfound". Also, check the permissions on the file.¶
One common error is caused by mismatched tags. For example, whenthere is a missing </t>, the error might appear as follows:¶
end tag "section" does not match open element "t" around line 65¶
Using Bill's xml2rfc validator can provide more precise error messages.¶
not yet updated--AR¶
A set of online citation libraries are maintained onxml2rfc.ietf.org [xml2rfc].They include citations for RFCs, Internet-Drafts, and documentsproduced by the W3C and 3GPP, amongothers.¶
To make use of the citation libraries, there are 2 methods:¶
define an ENTITY at the top:¶
<!ENTITY RFC2119 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">¶
and use &RFC2119; in the references section¶
use an include in the references section¶
<?rfc include="reference.RFC.2119.xml"?>¶
For an Internet-Draft, the citation file uses the draft string. For example:¶
<?rfc include="reference.I-D.ietf-wgname-topic.xml"?>¶
Preferably, use the citation libraries when possible. However,another option is to include the complete reference element (seeSection 3.2). Here's a template of areference element:¶
<reference anchor=""> <front> <title></title> <author initials="" surname="" fullname=""> <organization /> </author> <date month="" year="" /> </front> <seriesInfo name="" value="" /> </reference>¶
All are cited textually in the same manner -- by using xref elementswhere the target corresponds to the anchor of the reference element,e.g., <xref />. The anchors for RFCs are "RFCNNNN" (4 digits, using leading zeros) and the anchors for Internet-Drafts are "I-D.<name without "draft-ietf-" or the version number>".¶
There are several ways to insert the full reference element from thecitation library:¶
In therfc element, set the attributesymRefs="yes" forsymbolic references. This makes reference tags be the same as the anchor (e.g., [RFC2119]), instead of numerical (e.g., [1]).¶
symrefs="yes" is the default, starting with v1.33 of xml2rfc.¶
Use thedisplayreference element and set theto attribute tothe nickname. Tip: place it before thereferences element. For example:¶
<displayreference to="IKEv2"/><references>[...]<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7296.xml"/>¶
yields:¶
In the rfc element, set the attributesortRefs="yes". Note that sortRefs only has an effect ifsymRefs="yes".¶
The eref element for an external reference creates a link in the HTML output. For example:¶
<eref>¶
yieldshttps://www.w3.org.¶
<eref>W3C Home Page</eref>¶
yieldsW3C Home Page.¶
Another option is using xref and creating a reference that uses the target attribute for the URL. For example:¶
<reference anchor="W3C"> <front> <title>World Wide Web Consortium (W3C)</title> <author/> </front> </reference>¶
yields¶
[W3C] "World Wide Web Consortium (W3C)", <https://www.w3.org/>.¶
Use the name element (child of the references element) as follows:¶
<back> <references> <name>Normative References</name> ... </references> <references> <name>Informative References</name> ... </references> </back>¶
not yet updated--AR¶
Make sure the section you want to reference has an anchor attribute.For example:¶
<section title="Security Considerations" anchor="sec_cons">¶
Then, refer to it with an xref element:¶
See <xref />.¶
which yields the text output:¶
See Section 9.¶
(where the number of that section is determined dynamically).¶
not fully updated--AR¶
Use relref. Examples below are from draft-v3-features. SetdisplayFormat to various options.¶
"of": SeeSection 1 of [RFC7991]¶
"comma": See[RFC7991],Section 2.2¶
"parens": See[RFC7991] (Section A)¶
(default): SeeSection 1 of [RFC7991]¶
With text content: SeeSection 2 of [the wonderful Section 2 of RFC 7991]¶
Use the format attribute. For example, assuming the anchorattributes for the relevant sections have the values "sec_cons" and "IANA_cons":¶
See Sections <xref format="counter" /> and<xref format="counter" />.¶
yields the text output:¶
See Sections 9 and 10.¶
Note: The format attribute can have the value "title", which displays the title of thesection. For example,¶
See the <xref format="title" />.¶
yields the text output:¶
See the Security Considerations.¶
For bulleted lists, use the <ul> element.¶
For an empty list (indentation only), use the <ul> element withempty="true".¶
For definition lists (a.k.a. hanging lists in xml2rfc v2), use the <dl> element. SeeSection 4.4.¶
For numbers or letters, use the type attribute of the <ol> element; examples below.¶
For full details, seeSection 2.34.5 of [RFC7991]¶
(1)(2) is <ol type="(%d)">(3)(a)(b) is <ol type="(%c)">(c)REQ1:REQ2: is <ol type="REQ%d:">REQ3:¶
Set the group attribute of the <ol> element. For example:¶
Here is some text in between.¶
Use a <dl> element (definition list), where each <dt> (term) inhas a corresponding <dd> (description).¶
For example:¶
<dl> <dt>Unassigned:</dt> <dd>Unused and available for assignment via documented procedures.</dd> <dt>Reserved:</dt> <dd>Not to be assigned. Reserved values are held for special uses, such as to extend the namespace when it become exhausted. Reserved values are not available for general assignment.</dd></dl>¶
yields:¶
Note: The appearance is slightly different in the text output.¶
Usenewline="true" to get a linebreak after the term. For example:¶
<dl newline="true"> <dt>Unassigned:</dt> <dd>Unused and available for assignment via documented procedures.</dd> <dt>Reserved:</dt> <dd>Not to be assigned. Reserved values are held for special uses, such as to extend the namespace when it become exhausted. Reserved values are not available for general assignment.</dd></dl>¶
yields:¶
A CDATA block is left alone by xml2rfc. It does not try to parse XMLinside of a CDATA block. (For example, if a figure contains "<", you don'thave to use <) So it is especially good for when there are XMLexamples in the document.¶
not yet updated--AR¶
Remove the anchor attribute for that figure. Figure elements without anchor attributeswill not be automatically numbered (i.e., "Figure 1").¶
To prevent these characters from being parsed as XML, use¶
& for &< for <> for >¶
In addition, the following entities are defined:¶
' for '" for " for non-breaking space&nbhy; for non-breaking hyphen¶
Insert (non-breaking space) between words that you want to keeptogether on a line.¶
Use the role attribute of the author element. For example:¶
<author initials="J" surname="Doe" fullname="John Doe" role="editor">¶
You can use comments <!-- --> or <cref> elements. Comments are only visible in the XML source file.¶
Example of using comments:¶
<!-- [JD] This point needs revision.-->¶
<cref> will show up in the output when the attribute display="true" (which is the default).¶
Example of using <cref>:¶
<cref anchor="Q1" source="JD">This point needs revision.</cref>¶
yields¶
[[This point needs revision.--JD]]¶
xml2rfc validates it.Also, you can run rfclint:https://pypi.org/project/rfclint/.¶
not yet updated--AR¶
Yes, rfc2629.xslt by Julian Reschke provides a different kind ofHTML output than the HTML output mode ofxml2rfc. It is available for download fromhttp://greenbytes.de/tech/webdav/rfc2629xslt.zip. See"Transforming RFC2629-formatted XML through XSLT" for more information.¶
Yes, id2xml is available here:https://pypi.org/project/id2xml/. It is available as a webservice onhttps://xml2rfc.ietf.org/.¶
On the command line:xml2rfc --v2v3 inputfile.xml¶
Using the web service (https://xml2rfc.tools.ietf.org/experimental.html), select "Output format: convert v2 to v3 XML".¶
Some highlights are including UTF-8 characters, text formatting, and SVG diagrams. For complete details, seeSection 1.3 of [RFC7991]¶
Withencoding="utf-8" in your XML file, you can insert thecharacters directly into the file in the following locations:¶
Each of these elements has anascii attribute to holdthe ASCII equivalent, which will also appear in the output format. Forthe author element, the attributes are named asciiFullname,asciiInitials, andasciiSurnames.¶
For example:¶
<table anchor="table_ex"> <name>IETF Meetings in 2005</name> <thead> <tr> <th align='center'>IETF #</th> <th align='center'>City</th> <th align='center'># of Attendees</th> </tr> </thead> <tbody> <tr> <td align="center">62</td> <td align="center">Minneapolis</td> <td align="center">1133</td> </tr> <tr> <td align="center">63</td> <td align="center">Paris</td> <td align="center">1450</td> </tr> <tr> <td align="center">64</td> <td align="center">Vancouver</td> <td align="center">1240</td> </tr> </tbody></table>¶
yields:¶
| IETF # | City | # of Attendees |
|---|---|---|
| 62 | Minneapolis | 1133 |
| 63 | Paris | 1450 |
| 64 | Vancouver | 1240 |
Data fromhttps://www.ietf.org/how/meetings/past/.¶
For full details, seeSection 2.54 of [RFC7991]¶
You can check your SVG file against the SVG Tiny 1.2spec on the experimental page (https://xml2rfc.tools.ietf.org/experimental.html),and a script calledsvgcheck is available here:https://pypi.org/project/svgcheck/.¶
For more information, see[RFC7996] andTipson creating SVGfiles.¶
There are at least five ways to include SVG in artwork in Internet-Drafts:¶
- Inline, by including all of the SVG in the content of the element, such as: <artwork type="svg"><svg xmlns="http://www.w3.org/2000/ svg...">¶
- Inline, but using XInclude (see Appendix B.1), such as: <artwork type="svg"><xi:include href=...>¶
- As a data: URI, such as: <artwork type="svg" src="data:image/ svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3...">¶
- As a URI to an external entity, such as: <artwork type="svg" src="http://www.example.com/...">¶
- As a local file, such as: <artwork type="svg" src="diagram12.svg">¶
Use¶
Note: in the text output, <em> yields underscores, <strong> yieldsasterisks around the text, and <tt> yields quotation marks.¶
Use <sub> for subscript, and <sup> for superscript.¶
Example (from RFC 6330):¶
abnf, asn.1, bash, c++, c, cbor, dtd, java, javascript, json, mib,perl, pseudocode, python, rnc, xml, andyang.¶
Ths list is subject to change; for details, seeSection 2.48.4 of [RFC7991]¶
It is not aMUST, but it makes the usage moreclear.¶
SHOULD without the <bcp14> element,SHOULD with it.¶
Print the PDF.¶
The source files of RFCs have changed over time. Most RFCs haveNROFF source files; sometimes an XML filehas been archived. You can request an XML source filedirectly from rfc-editor@rfc-editor.org. After RFC TBD, the XML fileswill be available for downloadhttps://www.rfc-editor.org/retrieve/bulk.¶
This FAQ was made possible by the tools, documentation, and test filescreated by Henrik Levkowetz, Julian Reschke, and Sandy Ginoza.¶