[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XML vs the Dreaded Whitespace

  • From: "Rick Jelliffe" <ricko@a...>
  • To: <xml-dev@i...>
  • Date: Thu, 11 Dec 1997 21:33:08 +1100

xml whitespace preserved

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
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;">


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))


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.