Preserved space

A distinction is made between the act of leaving all whitespace characters intact, and normalizing whitespace down to a single character. When left intact, the whitespace is said to be preserved. When normalized, it is said to have collapsed, and this is usually what is desired.

XML:space attribute

The document author has some control over normalization of whitespace in the text, using a reserved attribute named ' xml:space'.

If this attribute is applied to a specific element, and given a value of 'preserve', then all whitespace in that element is deemed to be significant:

<para xml:space="preserve">ISO Central Secretariat
1, Rue de Varembe
CH-1211 Geneva 20
Switzerland</para>

    ISO Central Secretariat    1, Rue de Varembe ...

Get XML Companion, The, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.