Search code examples
xmlcoldfusionampersand

Why doesn't CFXML like &?


Using CFXML, I'm getting this error:

An error occured while Parsing an XML document. The entity name must immediately follow the '&' in the entity reference.

The dump shows ampersands used like this:

thing-&-things

Here's the code:

<cfxml variable="xml">
    <cfoutput>
        <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
            #xml#
        </urlset>
    </cfoutput>
</cfxml>

Why doesn't CFXML like this format for ampersands, and what format should they be in?


Solution

  • Use xmlFormat() around the data and it should fix your issue.