Xml2rfc generates RFCs and IETF drafts from document source in XML according to the dtd in RFC2629.
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.
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 setup.py 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
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:
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 setup.py 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.
The option --prefix allows you to specify the base path for all installation files. The setup.py 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 setup.py install --prefix=<path>
For further fine-tuning of the installation behavior, you can get a list of all available options by running:
$ python setup.py 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)
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.xmlxml2rfc draft.xml --dtd=alt.dtd --basename=draft-1.0 --text --nroff --html
xml2rfc depends on the following packages:
Version 2.9.1 (09 Feb 2018)
Boilerplate grammar fix, see https://www.rfc-editor.org/errata/eid5248
Version 2.9.0 (09 Feb 2018)
This release introduces preptool functionality, through a –preptool output mode. With reservation for some points for which issues has been raised, this follows the spedicfication in RFC7998.
The preptool currently takes vocabulary v3 input, and produces prepped output. When work on the text formatter commences, the idea is that the input xml source will always be run through v2v3 conversion and preptool processing before the output formatting, in order to increase consistency and reduce complexity of the output formatter.
There are also some changes which are not related to the preptool functionality: The tox tests have been changed to add testing under Python 3.6, and removed test runs for Python 3.3. Although there is no intention of breaking compatibility with Python 3.3, it may happen eventually since there will not be any release testing with that version of Python.
The v2v3 converter in some cases could insert <seriesInfo> elements with only a name= attribute, because the required seriesNo= attribute on <rfc> was missing. This has been changed.
In order to work around a debilitating issue with relax-ng validation in libxml2 (time to validate increases exponentially with number of attributes on the root element: https://bugzilla.gnome.org/show_bug.cgi?id=133736) some empty attributes on <rfc> are removed during processing; for instance obsoletes=”” and updates=””. They don’t contribute information, but increase validation time with a factor ~20.
In order to identify the unicode scripts needed to display a document, a module to efficiently identify the scripts related to unicode codepoints has been written. The ‘uniscripts’ module which was originally intended to be used for this turned out not to be viable. The new ‘scripts’ module can be broken out for separate release as a library module, if desired.
In order to work with vocabulary v3 input, the parser has been slightly modified to not do input validation according to rfc2629.dtd if not appropriate.
Version 2.8.5 (21 Jan 2018)
Changed a file open under python3 to use the newline= parameter to open() instead of the deprecated ‘U’ mode (thanks to firstname.lastname@example.org for pointing that out). Also changed the code to avoid a dangling open file handle.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.