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

Re: What to escape when serializing XML

  • From: Henri Sivonen <hsivonen@i...>
  • To: Pete Cordell <petexmldev@t...>
  • Date: Wed, 3 Jan 2007 11:00:16 +0200

xml escape cr lf
On Jan 2, 2007, at 17:11, Pete Cordell wrote:

> In terms of end-of-line encoding, the approach seems to be to  
> output what is convenient (CR, LF, or CRLF) and have the receiving  
> application sort out the situation.

More to the point, the LF character in element content can be  
serialized as CR, LF or CRLF. Of course, LF is the most natural  
serialization.

In order to avoid dataloss, LF, CR and tab need to be escaped in  
attribute values. Otherwise they are normalized to space by the  
parser. This matters for example when round-tripping multiline values  
in XHTML <input type='hidden'/>.

> Conceptually, the receiving XML processor should normalize the end- 
> of-line markers to 0x0A and then the application converts that to  
> which ever of CR, LF, or CRLF is appropriate.

For this reason, in order to avoid dataloss, CR needs to be escaped  
as an NCR to make it survive serialization and parsing round-tripping.

-- 
Henri Sivonen
hsivonen@i...
http://hsivonen.iki.fi/




[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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-2011 All Rights Reserved.