XML and whitespace: lets just dump CR and LF!

Rick Jelliffe ricko at allette.com.au
Tue Aug 5 15:12:30 BST 1997


> From: Neil Bradley <neil at bradley.co.uk>
> Reply-to:      Peter at ursus.demon.co.uk (Peter Murray-Rust)
 
> > Therefore I propose that those on XML-DEV who care about this problem come
> > up with some guidelines for implementers. 
 
> I very much hope this happens.
  
> > This means that the author/processor 'contract' has to be aware of this.
 

Can I suggest a very different tack?

The problem with CR/LF is one of overloading not of translation or contracts. 
They have too many meanings.  In particular they function both as 
record-start/-end characters and as new-lines.

I suggest that the following approach should be taken. (I think it is the only
realistic solution, especially if we assume that 1) data is usually generated by applications, 2) humans only check and tweak data;
3) we want operating system 
and character set independence, 4) line-breaking is generally done by clients
...so CR/LF is basically a convenience for fitting data into editors, 
not for the purposes of output.)

**A) XML applications should ignore *ALL* CR and LF as a bad joke.  They should
be entirely there for formatting the raw text into nice, eye-sized records.
So CR and LF should never be converted to spaces. (This approach was the
one taken by Interleaf, and I have come to appreciate it.) If you need a 
space, then start the new line with it!  (Ending the previous line is difficult
to see.)

**B) XML applications should mandate the use of the unambiguous Unicode characters
	-- LINE SEPARATOR  &#x2028;
	-- PARAGRAPH SEPARATOR &#x2029;

So if I want to do the equivalent of HTML 
<pre>  X<br>
</pre> 

XML can have:

<pre>&nbsp;&nbsp;X&#x2028;
<pre>

or even

<pre>
&nbsp;
&nbsp;
X


&x2028;<pre>

And it can do this with the text conventions of any operating system.

I certainly think that CR/LF should be not of interest to XML-lang. And I think
they should be of marginal interest to XML applications too. Lets dump them!


Rick Jelliffe 

xml-dev: A list for W3C XML Developers
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To unsubscribe, send to majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
List coordinator, Henry Rzepa (rzepa at ic.ac.uk)




More information about the Xml-dev mailing list