Reputation: 183569
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>
Upvotes: 3
Views: 1454
Reputation: 1589
needs to be CDATA:
<sample><![CDATA[Here is a line <br />Here is another]]></sample>
Upvotes: 4