Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xml-dev] What to escape when serializing XML

From: Henri Sivonen <hsivonen@---.-->
To: Pete Cordell <petexmldev@--------------.--->
Date: 1/3/2007 9:00:00 AM
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/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent