RssBandit, XML rendering and <xmp> element

Note: this entry has moved.

For those showing XML in a post, you surely know how annoying it is to be forced to convert all the tags to the corresponding escaped sequence in order to get it properly rendered. That is, change the < and > characters. There's a cool element, <xmp>, which allows arbitrary markup and tells the browser to show it as-is, without any processing. It's a kind of <pre> but better because you don't have to escape reserved characters.

Even though it was made obsolete by the HTML 4 specification, it remains a very useful element. In fact, despite the suggestion to use the <pre> element, there's no other element that offers the possibility to show markup without escaping it. What's more, both Gecko-based browsers (Netscape, Mozilla and Firebird) and IE properly render the element content untouched. Open this page in both and you'll see the XML at the very beginning properly displayed, even when it has not been escaped.

The strange thing is that even when RssBandit uses an embedded IE for post display, it's modifying the contents of the <xmp> and removing my formatting (tabs, whitespaces and line breaks), and that's why you would see the post rather ugly. Even more strange, it's doing so ONLY for XML content, not for the C# code I embedd... :S

9 Comments

Comments have been disabled for this content.