tag
I want to display an exception trace in the HTML page.
One way to do this is to escape HTML special characters in the exception trace and dump it inside the &l
Yes, but only in XHTML (in theory, I think it should work in HTML, but web browsers deal in tag soup not HTML 4.x) and not if you serve the document as text/html (which you have to if you want it to work with Internet Explorer).
As far as efficiency goes, replacing <, & and > with their respective entities is a trivial operation in any programming language (or text editor with a Find & Replace facility), which doesn't add a significant number of bytes except in conditions of extremely limited bandwidth.