XML: xml:space preserve

By Xah Lee. Date: . Last updated: .

Meaning of xml:space preserve

the xml:space="preserve" in XML is fairly complicated.

You cannot just delete it. But also, browsers may not support it.

A whitespace node in XML is a node that's all whitespace. [see DOM: Whitespace Nodes]

here's a example:

<p>I <b>love</b> <b>cats</b>.</p>

There is only ONE whitespace node above. It happens between the b tags.

Reference

xml space preserve 2023-01-03 c6QCF
[Understanding xml:space By Jesper Tverskov. At http://www.xmlplease.com/xml/xmlspace/ ]