2. To describesoftware that processes XML source files, including
tool that produces documents conforming to RFC 2223 [2],
format, and so on
3. To provide the proof-of-concept for the first two goals (
memo was written using this DTD and produced using software).
It is beyond the scope of this memo to discuss the
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 permits information to be organized, searched, and retrieved
both unstructured and structured mechanisms
Rose Informational [Page 3]
RFC 2629 Writing I-Ds and RFCs using XML June 1999
2. Using the DTD to Write I-Ds and
We do not provide a formal or comprehensive description of XML
Rather, this section discusses just enough XML to use a Document Declaration (DTD) to write RFC-like documents
If you're already familiar with XML, skip to Appendix B to look
the DTD
2.1 XML
There are very few rules when writing in XML, as the syntax
simple. There are five terms you'll need to know
1. An "element" usually refers to a start tag, an end tag, and
the characters in between, e.g., "text and/or elements"
2. An "empty element" combines the start tag and the end tag, e.g.,
"". You don't find these in HTML
3. An "attribute" is part of an element. If present, they occur
the start tag, e.g., "". Of course,
can also appear in empty elements, e.g., "".
4. An "entity" is a textual macro that starts with "&". Don't
about these, 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
either a letter or an underscore ("_"). Any characters
follow are either letters, numbers, an underscore, or a
(".").
First, start your source file with an XML declaration, a reference
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
present after the "" tag
Second, make sure that all elements are properly matched and nested
Rose Informational [Page 4]
RFC 2629 Writing I-Ds and RFCs using XML June 1999
A properly matched element that starts with "" is followed with "". (Empty elements are always matched.) Elements are properly nested when they don't overlap
Third, never use "<" or "&" in your text. Instead, use either "<"
or "&", respectively
Fourth, there are two quoting characters in XML, 'apostrophe'
"quotation". Make sure that all attributes values are quoted, e.g.,
"", If the value contains one of the
characters, then use the other to quote the value, e.g., "<
name='"'>", If the value contains both quoting characters, then
one of them to quote the value, and replace occurrances of character in the attribute value with either ''' (apostrophe)
""" (quotation), e.g., "".
If you want to put a comment in your source file, here's the syntax
Finally, XML is case sensitive
Rose Informational [Page 5]
RFC 2629 Writing I-Ds and RFCs using XML June 1999
The "title" element identifies the title of the document. Because
title will be used in the headers of the document when according to [2], if the title is more than 42 characters, then
abbreviation should also be provided, e.g.,
The IETF's Discussion on "Source Format of RFC Documents
Rose Informational [Page 6]
RFC 2629 Writing I-Ds and RFCs using XML June 1999
2.2.2 The author
Each "author" element identifies a document author. Since a
may have more than one author, more than one "author" element may
present. If the author is a person, then three attributes must
present in the "" tag, "initials", "surname",
"fullname", e.g.,
The "organization" element is similar to the "title" element, in
an abbreviation may be paired with a long organization name using
"abbrev" attribute, e.g.,
The "postal" element contains one or more "street" elements,
by any combination of "city", "region" (state or province), "code
(zipcode or postal code), and "country" elements, e.g.,
660 York StreetM/S 40San FranciscoCA94110US
This flexibility is provided to allow for differentnational
for postal addresses. Note however, that although the order of
"city", "region", "code", and "country" elements isn't specified,
most one of each may be present. Regardless, these elements must
be re-ordered during processing by an XML application (e.g., applications must preserve the ordering of the information
in these elements). Finally, the value of the "country"
should be a two-letter code from ISO 3166.
Rose Informational [Page 7]
RFC 2629 Writing I-Ds and RFCs using XML June 1999
The "phone", "facsimile", "email", and "uri" elements are simple
e.g.,
+1 415 695 3975mrose@not.invisible.nethttp://invisible.net/
2.2.3 The date
A document may have one or more "note" elements, each of contains one or more "t" elements (Section 2.3.1.1). There is mandatory "title" attribute. In general, the "note" element
text from the IESG, e.g.,
Note that text relating to the memo's status, copyright notice,
table of contents is not included in the document's markup -- this
automatically inserted by an XML application when it produces
a text or HTML version of the document
If an Internet-Draft is being produced, then the "ipr"
should be present in the "" tag at the beginning of the file
The value of the attribute should be one of
noDerivativeWorks2026: indicating that the document is in conformance with all the provisions of Section 10 of RFC 2026
except that the right to produce derivative works is not granted
or
none: indicating that the document is NOT offered in accordance
Section 10 of RFC 2026, and the author does not provide the
with any rights other than to publish as an Internet-Draft
Rose Informational [Page 9]
RFC 2629 Writing I-Ds and RFCs using XML June 1999
Finally, if the Internet-Draft is being submitted to an
process, then the "docName" attribute should be present in
"" tag at the beginning of the file. The value of this contains the document (not file) name associated with this Internet
Draft, e.g.,
Each "section" element contains a section of the document. There is mandatoryattribute, "title", that identifies the title of
section. There is also an optionalattribute, "anchor", that is
for cross-referencing with the "xref" element (Section 2.3.1.4),
e.g.,
Introduction">
...
Rose Informational [Page 11]
RFC 2629 Writing I-Ds and RFCs using XML June 1999
The "section" element is recursive -- each contains any number combination of "t", "figure", and "section" elements, e.g.,
...
... ..................
2.3.1.1 The t
The "t" element contains any number and combination of paragraphs
lists, and figures. If a cross-reference is needed to a section
figure, or reference, the "xref" element (Section 2.3.1.4) is used
similarly, if an external-reference is needed, the "eref"
(Section 2.3.1.5) is used. Indexing of text is provided by the
"iref" element (Section 2.3.1.6).
2.3.1.2 The list
The "list" element contains one or more items. Each item is a "t
element, allowing for recursion, e.g.,
The pfirst item.The second item, which contains two bulleted sub-items The first sub-item.The second sub-item.
The "list" element has an optionalattribute, "style", having
value "numbers" (for numeric lists), "symbols" (for bulleted lists),
"hanging" (for hanging lists), or, "empty" (for indented text). If
"list" element is nested, the default value is taken from its
parent; otherwise, the default value is "empty".
Rose Informational [Page 12]
RFC 2629 Writing I-Ds and RFCs using XML June 1999
When nested within a "hanging list" element, the "t" element has optionalattribute, "hangText" that specifies the text to
inserted, e.g.,
indicating that the document is
full conformance with all the provisions of Section 10 of
2026; indicating that document is in full conformance with all the provisions
Section 10 of RFC 2026 except that the right to
derivative works is not granted; or, indicating that the document is
offered in accordance with Section 10 of RFC 2026, and
author does not provide the IETF with any rights other
to publish as an Internet-Draft.
2.3.1.3 The figure
The "figure" element groups an optional "preamble" element,
"artwork" element, and an optional "postamble" element together.
"figure" element also has an optional "anchor" attribute that is
for cross-referencing with the "xref" element (Section 2.3.1.4).
There is also an optional "title" attribute that identifies the
of the figure
The "preamble" and "postamble" elements, if present, are simply text
If a cross-reference is needed to a section, figure, or reference
the "xref" element (Section 2.3.1.4) is used; similarly, if external-reference is needed, the "eref" element (Section 2.3.1.5)
used. Indexing of text is provided by the the "iref" element (
2.3.1.6).
The "artwork" element, which must be present, contains "
artwork". Unlike text contained in the "t", "preamble",
"postamble" elements, both horizontal and vertical whitespace significant in the "artwork" element
Rose Informational [Page 13]
RFC 2629 Writing I-Ds and RFCs using XML June 1999
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
trick you can use
If you have artwork with a lot of "<"
characters, then there's an XML trick you
use:
ascii artwork goes here...
just don't use "]]" in your artwork
]]>The "<![CDATA[ ... ]]>" construct is
a CDATA block -- everything between the innermost
is left alone by the XML application.
The "" construct is called a CDATA block --
everything between the innermost brackets is left alone by the application
Because the "figure" element represents a logical grouping of
and artwork, an XML application producing a text version of document should attempt to keep these elements on the same page
Because RFC 2223 [2] allows no more than 69 characters by 49 lines
content on each page, XML applications should be prepared
prematurely introduce page breaks to allow for better
grouping
Rose Informational [Page 14]
RFC 2629 Writing I-Ds and RFCs using XML June 1999
Finally, the "artwork" element has two optional attributes: "name
and "type". The former is used to suggest a filename to use
storing the content of the "artwork" element, whilst the contains a suggestive data-typing for the content
Finally, note that the "iref" element is always empty -- it contains any text
2.3.1.7 The vspace
The "vspace" element, which may occur only inside the "t" element,
used by the author to provide formatting guidance to the application. There is an attribute, "blankLines", that indicates
number of blank lines that should be inserted. A physical
is specified by using the default value, "0".
In addition, the "vspace" element can be used to force a new paragraph within a list item, e.g.,
This is list item
This is part of the same list item
although when displayed, it
as a separatephysicalparagraph.
An XML application producing a text version of the document exercise care when encountering a value for "blankLines" that
a pagebreak -- in particular, if a "vspace" element causes
pagebreak, then no further blank lines should be inserted.
allows authors to "force" a pagebreak by using an arbitrarily
value, e.g., "blankLines='100'".
Finally, note that the "vspace" element is always empty -- it contains any text
Rose Informational [Page 16]
RFC 2629 Writing I-Ds and RFCs using XML June 1999
2.4 Back
Finally, the "back" element is used for references and appendices
The "reference" element also has an optional "target" attribute
is used for externalreferences (c.f., Section 2.3.1.5). The application, if producing an HTML version of the document will
the "target" attribute accordingly; however, if the "name"
of the "seriesInfo" element has the value "RFC", then the application should automatically provide an appropriate default
the "target" attribute (e.g., "http://example.com/rfcs/rfc2200.txt").
2.4.2
To include appendices after the bibliography, simply add
"section" elements. (For an example, look at the example at
beginning of Section 2.4.)
This section concerns itself with applications that operate on an
source file. A lot of XML tools are available, as are many lists
XML resources, e.g., Cafe con Leche [5].
There are two kinds of XML tools: validating and non-validating
Both check that the source file conforms to the rules given
Section 2.1. However, in addition to making sure that the source
is well-formed, a validating tool also reads the DTD referenced
the source file to make sure that they match. There are a number
both validating and non-validating tools available
3.1
There are several XML editors available. Ideally, you want an
that validates. This has two advantages
o the editor validates that the source file matches the rules in
DTD
There are two major modes in Emacs that support XML: tdtd [6]
psgml [7]. The latter mode allows you to validate the source file (
calling an external program). If you visit the source file in
and the major mode isn't "SGML" or "XML", then usually all it
is adding these lines to your ".emacs" file
and then restarting Emacs. If this doesn't work, try one of
sources above
The author uses both sgml-mode in Emacs, and a commercial
editor, Clip! version 1.5 [8], when editing source files
3.1.1
If your editor doesn't validate, then you should run a program validate the source file
The author uses the AlphaWorks XML parser [9] for this purpose.
requires that your system have a Java virtual machine. In addition
Java, there are validating parsers written in C, Perl, Python,
Tcl
Rose Informational [Page 19]
RFC 2629 Writing I-Ds and RFCs using XML June 1999
3.2 Converting to Text
The author has written the xml2rfc tool [10], which reads the
file and produces both a text and HTML version of the document
(This memo was produced using the xml2rfc tool.) Note that xml2
isn't a validating tool, so it's a good idea to use either
validating editor or run a stand-alone validating parser prior
using the tool
3.3 Converting to HTML
The XML Style Language (XSL) is used to describe transformations
the source file into some other structured file. So, ideally
should use an XSL-capable formatter to convert an XML source file
HTML
However, as of this writing XSL is still in considerable flux
(Hence, no reference was included in this memo, as by the time
read this section, the reference would be outdated.) So, in
interim, the author uses the xml2rfc tool for this purpose,
though this tool doesn't provide much flexibility in its HTML layout
3.4
Browsers that support either XSL or Cascading Style Sheets (CSS)
able to view the source file directly
At present, the author doesn't use any of these browsers,
converting source files to either text or HTML
3.5
As with text editors, any text-oriented search tool (e.g., grep)
be used on the source file. However, there are search tools
that understandstructured source
The author uses sgrep version 1.9 [11] for this purpose, e.g
sgrep -g xml 'ELEMENTS("title") not in ELEMENTS("back")' \
writing-rfcs.
which extracts the title element from the source file
Rose Informational [Page 20]
RFC 2629 Writing I-Ds and RFCs using XML June 1999
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
is produced, e.g.,
5. "info", the default, for an Informational document
o "seriesNo", having the corresponding number in the STD (std),
(bcp), or FYI (info) series
Finally, a special entity, "&rfc.number;", is available.
preparing an RFC should use this entity whenever they want reference the number of the RFC within the document itself.
printed versions of the document, the appropriate substitution (
"XXXX") will occur
Rose Informational [Page 23]
RFC 2629 Writing I-Ds and RFCs using XML June 1999
The author gratefully acknowledges the contributions of:
Barrett, Brad Burdick, Brian Carpenter, Steve Deering, Faltstrom, Jim Gettys, Carl Malamud, Chris Newman, Kurt Starsinic
and, Frank Strauss
Rose Informational [Page 29]
RFC 2629 Writing I-Ds and RFCs using XML June 1999
how to 16
Rose Informational [Page 30]
RFC 2629 Writing I-Ds and RFCs using XML June 1999
The limited permissions granted above are perpetual and will not
revoked by the Internet Society or its successors or assigns
This document and the information contained herein is provided on
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
if you see any problems within the linking, don't worry be happy,
this is version 0.1 of the Relevance System and you gotta expect some crappy subroutines sometimes,
just be content we did not write this in Java, which would have made this "bigger and better" HAHAHHA.