XML 回车编码 [英] XML Carriage return encoding
本文介绍了XML 回车编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望在 xml 节点中表示回车.
我尝试了一个没有运气的空白保留,十六进制实体 -
和.通过浏览器查看.
I was looking to represent a carriage return within an xml node.
I have tried a whitespace preserve, hex entity with no luck-
and a
. viewing via a browser.
示例
<Quote>
Alas, poor Yorick!
I knew him
</Quote>
谢谢.
推荐答案
要将 CR 插入 XML,需要使用其字符实体
.
To insert a CR into XML, you need to use its character entity
.
这是因为兼容的 XML 解析器必须在解析之前将 CRLF 和任何后面没有跟 LF 的 CR 转换为单个 LF.此行为在行尾处理中定义XML 1.0 规范的一部分.
This is because compliant XML parsers must, before parsing, translate CRLF and any CR not followed by a LF to a single LF. This behavior is defined in the End-of-Line handling section of the XML 1.0 specification.
这篇关于XML 回车编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文