XML回车编码 [英] XML Carriage return encoding

查看:114
本文介绍了XML回车编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个xml节点中的回车符。

我尝试过一个空格保留,没有运气的十六进制实体
和。



示例

 < Quote> 
唉,可怜的Yorick!
我知道他
< / Quote>

谢谢。

解决方案

要将CR插入XML,您需要使用其字符实体&#10;



这是因为兼容的XML解析器在解析之前必须将CRLF和任何不跟随LF的CR转换为单个LF。此行为在行尾处理中定义XML 1.0规范的部分。


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 \n. viewing via a browser.

Example

<Quote>
Alas, poor Yorick!
I knew him
</Quote>

Thanks.

解决方案

To insert a CR into XML, you need to use its character entity &#10;.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆