Matt Gifford aka coldfumonkeh | Consultant Developer
View Github Profile


The processing instruction target matching "[xX][mM][lL]" is not allowed

Jan 17, 2011

Whilst working on the Scotch on the Rocks 2011 site, I also created a mini-api to power the application and to allow remote access for external applications.

During testing of the XML output, I received a strange error message that I had not previously encountered:

The processing instruction target matching "[xX][mM][lL]" is not allowed

The work in question was converting a ColdFusion query recordset into an XML document with one node per row of data returned. It turns out the issue was arising due to whitespace at the top of the document, and was resolved by removing the whitespace from the CF code generating the XML content.

<cfsavecontent
variable="strReturnData"><?xml version="1.0" encoding="utf-8"?>
<rootNode>
	<totalrecords></totalrecords>
	<cfoutput query="myQuery">
	<itemNode>

	</itemNode>
    </cfoutput>
</rootNode>
</cfsavecontent>

Notice how the XML tag starts immediately after the cfsavecontent tag closes at the top? Yes, I had to sacrifice beautifully laid out, tabbed code, but it removed the whitespace from the top of the document, and this error was dealt with.


Latest Blog Posts

Jul 16, 2020
Github Actions with CommandBox and TestBox
Read More
Jul 9, 2020
Azure pipelines with CommandBox and TestBox
Read More
Dec 23, 2019
CFML content moderation detection component library
Read More