XML托架返回编码
我打算代表XML节点中的马车返回。
我尝试了一个没有运气和\ n的六角实体。通过浏览器查看。
例子
<Quote>
Alas, poor Yorick!
I knew him
</Quote>
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要将CR插入XML中,您需要使用其字符实体
&amp;#13;
。这是因为在解析之前,必须将符合性的XML解析器转换为CRLF,而不会将LF随后的CR转换为单个LF。此行为是在
To insert a CR into XML, you need to use its character entity
.
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:Space =“ Preserve”
必须为所有合规的XML解析器工作。但是,请注意,在html中,线路断开只是空格而不是线路休息(这是用
&lt; br /&gt; < /code>(x)HTML标签表示的,也许这是您存在的问题 。
面对
xml:space="preserve"
has to work for all compliant XML parsers.However, note that in HTML the line break is just whitespace and NOT a line break (this is represented with the
<br />
(X)HTML tag, maybe this is the problem which you are facing.You can also add
and/or
to insert CR/LF characters.
浏览器不会可靠地向您显示空白。我建议Linux“ OD”命令查看实际上的内容。合并XML解析器将尊重您列出的所有方法。
A browser isn't going to show you white space reliably. I recommend the Linux 'od' command to see what's really in there. Comforming XML parsers will respect all of the methods you listed.