Should XML CDATA be shown in your browser?
I just spent 1/4 of a day diagnosing a problem that got totally wiped out because, as it turns out, Firefox and IE display XML differently.
In IE, rocketboom’s XML looks like this:
<title>rb_06_aug_04</title>
– <description>
– <![CDATA[ <p><b>story links:</b> <a href=”http://www.racewalk.com” targe
While the same file looks like this in Firefox:
<title>rb_06_aug_04</title>
−
<description>
<p><b>story links:</b> <a href=”http://www.racewalk.com” targe….
Hey! Firefox doesn’t show the CDATA tag! If you look in the source, it’s still there, Firefox just doesn’t show it in the browser. Should it?
On one hand, when you look at XML files, you just want to see everything since it’s machine code anyway. Maybe a little formatting would be nice and colors to go easy on the eyes but that’s it. On the other hand, it shouldn’t be shown because it’s meta-data. Grrrrrrr. Why can’t everything just be simple?
Aside from XHTML, people shouldn’t (“shouldn’t”) be reading Xml…at least not in web browsers.
So Firefox is wrong and it should have just spit out the data?
The problem is that FF doesn’t render CDATA properly even if you transform it via XSL, which is for users.