CFXML – "Premature end of file" when enablecfoutputonly is "yes"

When I run the following code within a .CFM file on a server running ColdFusion 2018:

<cfsetting enablecfoutputonly="yes">  <cfxml variable="test">     <test>         <child>test</child>     </test> </cfxml>  <cfsetting enablecfoutputonly="no"> 

I receive the error:

An error occurred while Parsing an XML document. Premature end of file. 

When I remove the <cfsetting> tags, it works with no errors. Why is this?

Add Comment
1 Answer(s)

The issue you have is that the xml content is being take as blank. Use this.

Since you have your cfsetting tag to enablecfoutputonly, we can say that the cfxml tag can see the content only if it is enclosed in cfoutput.

<cfxml variable="test">     <cfoutput>     <test>         <child>test</child>     </test>     </cfoutput> </cfxml> 

Original Code

Working Demo

Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.