开发者

Does CDATA preserve all escaped character sequences in XML?

Do XML parsers translate escaped characters such as 
 and 
 even when they occur in CDATA?

I was confused by the answer to this question: Does the XML specification states that parser need to convert \n\r to \n always, even when \n\r appears in a CDATA section?

...because it quotes from the spec saying that sequences like #xD #xA are replaced with a single '\n' character, but then goes on to say that using 
 and 
 is a reliable way to preserve the characters. Is the semi-colon significant? (I don't have time to study the XML spec)

Also, I am aware that the 2 characters above are carriage return and开发者_开发百科 line feed, and that they are normalized to just line feed by XML parsers - if the rules for what happens inside CDATA for line breaks is different to escaped sequences in general, then I hereby ask both questions!

Thanks, rp


Nope. The parser does not touch anything in a CDATA section.

The semicolon does not make a difference.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜