# About White Space Handling

Amaya removes insignificant white-space characters when it loads a document unless they must be explicitly preserved. This is true for XHTML, MathML, and SVG documents, as well as MathML or SVG elements included in a HTML document,

The following are considered as insignificant white-space characters:

- End of line characters (`#xD` and `#xA`)
- Tab characters (`#X9`)
- Leading spaces of an element
- Trailing spaces of an element
- Contiguous spaces (one space is preserved)

To preserve all the characters for some elements, use the `xml:space` attribute or the `PRE` element (only valid for XHTML documents). The possible values for the `xml:space` attribute are `default` and `preserve`.

- The value `default` means that an applications' default white-space treatment is acceptable for these elements. In Amaya, the default treatment removes the insignificant white-space characters for all supported DTDs (see above).

- The value `preserve` indicates that applications will preserve all the characters, except the first one that immediately follows the end tag of the element where it is specified, if that element is an end of line.

You apply the `xml:space` attribute to all elements within the content of the element where it is specified, unless it is overriden with another instance of the `xml:space` attribute.

In an XHTML DTD, the `PRE` element causes the same behavior as the `xml:space` attribute with the value `preserve`.

Amaya applies white space handling when it loads a document, not during editing. A consequence is that if you type insignificant white-space characters, they will be visible and saved but will be removed the next time the document is loaded. For example, the following source code:

`<p>Amaya removes the <strong> insignificant white-space </strong>when it loads ...</p>`

displays as follows during editing:

`Amaya removes the insignificant white-space when it loads...`

The text will be saved with that syntax. However, the next time the document is loaded, the text will display as:

`Amaya removes theinsignificant white-spacewhen it loads...`

because the leading and trailing spaces of the element `<strong>` are considered to be insignificant and are removed.

The correct source code would be:

`<p>Amaya removes the <strong>insignificant white-space</strong> when it loads ...</p>`