OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: XML vs the Dreaded Whitespace

[ Lists Home | Date Index | Thread Index ]
  • From: "Rick Jelliffe" <ricko@allette.com.au>
  • To: <xml-dev@ic.ac.uk>
  • Date: Thu, 11 Dec 1997 21:33:08 +1100


Attached is a repost summary of the white-space characters available in
XML from ISO 10646.  Of course, it is still up to applications to implement
them correctly. 

At the moment, spaces and newlines are very overloaded which causes all
sorts of problems.  So it would solve many problems to use these characters.

For example, if you want a hard return, use the hard return character &#x2028;
and if you need non-collapsing white-space, use &#x3000; 

In this particular case, one thing to do is put an attribute at the top-level element
	xml:space="preserve"
to prevent collapsing and stripping of spaces and tabs.  As far as CR/LF, 
I think the XML spec can only be interpreted to mean that

   <!ENTITY cr     "&#13;">
   <!ENTITY lf     "&#10;">

<p>&#13;&#10;</p>

should be preserved.  This is because 2.11 

"To simplify the tasks of applications, wherever an external 
parsed entity or the literal entity value of an internal parsed 
entity contains either the literal two-character sequence 
"#xD#xA" or a standalone literal #xD, an XML processor must 
pass to the application the single character #xA. (This behavior 
can conveniently be produced by normalizing all line breaks 
to #xA on input, before parsing.)"

So normalization *should* apply only to direct characters, not
references.  However, I dont think you can trust parsers to
do this.  So if you want to send facsimile documents
with whitespace preserved, you might find you have to
use a Unicode private-use-area character to substitute for CR.
Your application at the other end has to replace that character
again to reconstruct the document.

For example, you could use

	<!ENTITY cr  "&#xF00D" >


This is a case where you want to do something that is definitely
contrary to the simplifying rules of XML, so don't be alarmed
that you have to use markup (which you give a significance to)
rather than being able to do it direct. 


Rick Jelliffe

space (1).htm (Internet Document (HTML))





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS