The XML Recommendation defines whitespace as a single
term for the space, tab, and linebreak characters which may appear in
a document. When such characters appear in a document as content of a
text node, XML generally considers them significant and requires that
a processor preserve all of them. However, when an element is defined
as containing only other elements, the usual expectation is that any
white space characters adjacent to the markup tags used to delimit
those elements are not significant and may be ignored by
an XML processor. This does not, of course, apply to whitespace
characters within an element containing mixed content, which must be
preserved. Hence, in a document like the following
- apple pie
- banana custard
- carrot cake
the white space between the first and second items, and that between the
second and third, is significant only if the content model for
list permits text as well as item elements. The
spaces within individual items are however always significant.
A further complication is that some XML processors, notably XML
editors, may introduce white space in a document to enhance its
readability when it is displayed.
Most TEI elements are defined as having mixed content, and
for the most part TEI markup appears at places in a document where the
presence or absence of whitespace is not in any case significant.
The xml:space attribute is therefore of little
importance. There are however a few situations in which it may be
essential, typically where complex markup is being worked on by a tool
which introduces whitespace in order to enhance display of the text.
For example, when transcribing an inscription with the elements
described in chapter , a single word may well gain
several additional tags to mark parts of the word which are supplied
or conjectural. Such tags do not interrupt the word however, and hence
introducing space where they occur would be misleading. The value of
preserve for the xml:space attribute on the
parent div element may be used to indicate that all and only
the spaces actually present in the XML source should be regarded as
significant; an editor is not then permitted to introduce additional
spaces.