Unqualified XML's and cfheader
I've been playing around with creating an XML file this morning from a plain .cfm page and came across an annoyance. Now I've done this loads but this morning I was creating my own Ajax functions which meant the cfm page had to return a fully qualfied as XML which was passed into Javascripts XML parser, but Js was passing an error.
The test code was simple[xml.cfm]
<cfheader name="Content-Type" value="text/xml">
<?xml version="1.0" encoding="UTF-8"?>
<root>
<node>
<child>1</child>
</node>
<root>
The problem was CFHEADER adds a couple of blank lines to the top of the page meaning that the page did not pass as XML. Well thanks to Rob Wilkerson on CF-Talk/houseoffusion.com the anser was obvious simple - use CFCONTENT
<cfcontent type="text/xml" reset="Yes" />
<?xml version="1.0" encoding="UTF-8"?>
<root>
<node>
<child>1</child>
</node>
<root>
I did try a few other ways of surpressing the white space usin a variety of methods but nothing came close.