Skip to main content

Xml2rfc generates RFCs and IETF drafts from document source in XML according to the dtd in RFC2629.

Project description


The IETF uses a specific format for the standards and other documents it publishes as RFCs, and for the draft documents which are produced when developing documents for publications. There exists a number of different tools to facilitate the formatting of drafts and RFCs according to the existing rules, and this tool, xml2rfc, is one of them. It takes as input an xml file which contains the text and meta-information about author names etc., and transforms it into suitably formatted output. The input xml file should follow the DTD given in RFC2629 (or it’s inofficial successor).

The current incarnation of xml2rfc provides output in the following formats: Paginated and unpaginated ascii text, html, nroff, and expanded xml. Only the paginated text format is currently (January 2013) accepable as draft submissions to the IETF.


System Install

To install a system-wide version of xml2rfc, download and unpack the xml2rfc distribution package, then cd into the resulting package directory and run:

$ python install

Alternatively, if you have the ‘pip’ command (‘Pip Installs Packages’) installed, you can run pip to download and install the package:

$ pip install xml2rfc

User Install

If you want to perform a local installation for a specific user, you have a couple of options. You may use python’s default location of user site-packages by specifying the flag --user. These locations are:

  • UNIX: $HOME/.local/lib/python<ver>/site-packages

  • OSX: $HOME/Library/Python/<ver>/lib/python/site-packages

  • Windows: %APPDATA%/Python/Python<ver>/site-packages

You can additionally combine the flag --install-scripts with --user to specify a directory on your PATH to install the xml2rfc executable to. For example, the following command:

$ python install --user --install-scripts=$HOME/bin

will install the xml2rfc library and data to your local site-packages directory, and an executable python script xml2rfc to $HOME/bin.

Custom Install

The option --prefix allows you to specify the base path for all installation files. The script will exit with an error if your PYTHONPATH is not correctly configured to contain the library path the script tries to install to.

The command is used as follows:

$ python install --prefix=<path>

For further fine-tuning of the installation behavior, you can get a list of all available options by running:

$ python install --help


xml2rfc accepts a single XML document as input and outputs to one or more conversion formats.

Basic Usage: xml2rfc SOURCE [options] FORMATS...


The following parameters affect how xml2rfc behaves, however none are required.






purge the cache and exit



show the help message and exit



disable DTD validation step



don’t use the network to resolve references



dont print anything



print extra information



display the version number and exit



specify the base name for output files



specify an alternate cache directory to write to



run as if todays date is DATE (format: yyyy-mm-dd)

-d DTD


specify an alternate dtd file



specify an output filename


At least one but as many as all of the following output formats must be specified. The destination file will be created according to the argument given to –filename. If no argument was given, it will create the file(s) “output.format”. If no format is specified, xml2rfc will default to paginated text (--text).




outputs to a text file, unpaginated


outputs to a text file with proper page breaks


outputs to an nroff file


outputs to an html file


outputs to an XML file with all references expanded

xml2rfc draft.xml
xml2rfc draft.xml --dtd=alt.dtd --basename=draft-1.0 --text --nroff --html


xml2rfc depends on the following packages:


Version 2.10.0 (12 Jul 2018)

This release introduces the vocabulary v3 text formatter. In order to invoke this formatter, use the regular –text switch for text output, and add the –v3 switch to specify the v3 text formatter.

Xml2rfc in v3 text formatter mode accepts any valid xml2rfc input file, but since the actual formatter only understands the XML elements and attributes which have not been deprecated by RFC7991, it first applies the xml2rfc v2v3 converter in order to transform any deprecated markup to the elements and attributes it understands, and then applies the preptool in order to normalize the input before it starts rendering.

This is the first release of the v3 text formatter, and there are some known rough edges and deficiencies:

  • The current table output renders all table borders. This differs from the v2 formatter, and will be remedied in a later release. The reason for doing the first release with this rendering of tables is that the table layout options have changed substantially with the possibility of using rowspans, and the table layout code is much more complex than for v2 as a consequence. With all table borders visible, the initial testing of the layout code has been easier than if horizontal borders were not rendered.

  • The statement of work for the text formatter coding does not include paginated output, and as a consequence the Table of Contents is much less informative than it would be if it was able to show the page for each ToC entry.

  • The xml2rfc v3 vocabulary (RFC 7991) does not provide ‘align’ attributes for tables, which means that the ability to center and right-align tables is lost. All tables are left-aligned. (Alignment of text within each cell is still supported, though.)

  • The index generation (using <iref> elements) has some known issues, which will also be fixed in a subsequent release.

The v3 schema used in this release differs from the schema specified in RFC7991 in some respects. A separate document will be published with details about the changes: draft-levkowetz-xml2rfc-v3-implementation-notes. The issues leading to the changes will also be entered in the document issue trackers and sent to the xml2rfc-dev mailing list for discussion.

Feedback on the v3 text formatter will be appreciated. Please send feedback to or

Version 2.9.9 (25 Jun 2018)

  • Applied patch from to let run under python 3. Fixes issue #345.

  • Removed from xml2rfc notifications.

Version 2.9.8 (17 Jun 2018)

  • Fixed a problem with release 2.9.7 when processing private mode input files

Project details

Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xml2rfc-2.10.0.tar.gz (2.0 MB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page