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>
精彩评论