Skip to main content
Inspiring
June 22, 2010
Question

XML issue

  • June 22, 2010
  • 1 reply
  • 1193 views

I have some CF code that generates dynamic XML files, although it gives a CFM extension to the file our desktop app is able to read them correctly. However we've come across a little bit of a problem.

When the CFM page pulls data from the SQL dbase and creates the XML file, the code fails if any of the text placed into the fields within the XML contain ampersands.

Does anybody know if there is a particular way that we can display ampersands without causing the XML to fail? For now we've had to just remove them

I presume there might also be other characters that could be problomatic within XML's?

Perhaps we have to convert the & to an ascii character?

If so, anybody have any code that covers all problomatic characters to do a CF type REPLACE of all of them in one go?

Thanks

Mark

This topic has been closed for replies.

1 reply

Participating Frequently
June 22, 2010

Try replaceing the & with &

Ken Ford

Inspiring
June 22, 2010

Please post a sample of the code that generates the XML.  I suspect that using the XmlFormat() function will solve your issue.

Inspiring
June 22, 2010

Ben Forta's web site contains some chapters from his CF books as PDF files.  These include coverage of XML that you may find useful.

http://www.forta.com/books/0321515463/CFWACK8-2-EChapters.pdf