开发者

How to encode a linebreak in XML

I have XML elements that开发者_开发知识库 contain text with newlines but no other formatting. The text is being read by javascript and displayed in HTML. Is there an XML-safe way to encode the linebreak, or does this text need to be CDATA?

Example:

<sample>Here is a line <br>Here is another</sample>


needs to be CDATA:

<sample><![CDATA[Here is a line <br />Here is another]]></sample>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜