On 28 Nov 2015, at 10:43, Hussein Shafie wrote:

<body>
<h1>Header</h1>
<p>First</p>
<p>Second</p>
</body>

[...] the above snippet is displayed as follows (no matter the snippet contains CRLF or just LFs):
---
Header
(empty line; in fact empty text node)
First
(empty line; in fact empty text node)
Second
---

Given that XXE’s philosophy is to **NOT** save as much whitespace as possible and that it instead **IS** to focus on edititing structure, then I must admit that I find the above behavior as counter-productive and counter-intuitive. In fact, when using XXE to edit documents edited elsewhere, I frequently find myself deleting semantingly meaningless empty lines. After all, until I delte the whitespace, I do not know whether the empty lines e.g. is an empty <p> element or what it is.

And as to how Web browsers treat *XML* documents (such as *XHTML* documents) then they do not "strip" the extra whitespace of your example. (And in fact, that seems to be the same for HTML as well as for XHTML!) What they do is that they *display* the document as if it has stripped the whitespace. (And if you copy the text of the rendered document then, as well, that whitespace isn’t there.) But if you dig into the DOM of the document, then you will find that all the inter-element whitespace is available (e.g. for JavaScript). (I do not deny that there are differences between how whitespace is handled in HTML and XML, but the inter-element whitespace is not handled differently, as far as I can recall.)

And since XXE is able to hide the empty lines for those elements that do not permit textual content - and this without deleting the whitespace between those elements, it does not seem to be lack of ability that is the reason why XXE does not hide the interelement whitespace that I have in mind.

Two questions:

(1) What negativive effects would we get if XXE started to **hide** (not delete!) such inter element whitespace even in _block_ elements that may contain text?

(2) If this behavior cannot be altered (whether by user preference or the XMLmind developers), then what about an option to preprocess the document so that whitespace gets physically collapsed/stripped? (For me, it would be OK to delete it, without warning users, but that might be too drastic, since it would be a new behavior ... despite that it seems in line with the XXE philosophy ...)
--
leif halvard silli

--
XMLmind XML Editor Support List
xmleditor-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to