![]() | |||||
![]() |
|||||
|
XML Safe Text
I've been working on improving the RSS feeds generated by Lighthouse. One persistent problem is that some RSS readers (IE, for instance) will choke on a lot of special characters, such as those pasted from Microsoft Word. I have previously put in place code to replace many of those characters, but came across another one today that wasn't replaced. I knew I needed a better solution. On CFlib.org, I found a function called xmlFormat2 that smartly avoids maintaining a list of characters to replace, and just replaces all characters not in a list of "good" characters. That makes sense. And it works. I was concerned, though, about the performance of the function, and I thought it could be done better. Using the REMatch function (introduced in ColdFusion 8), I was able to make the function both simpler and much faster. My tests so far have been limited, but it has so far handled everything I have thrown at it. And here it is: <cffunction name="XmlSafeText" hint="Replaces all characters that would break an xml file." returnType="string" output="false"> It should be possible to use it as a replacement for the built in XmlFormat function. Let me know if you run into any problems with it. Posted on July 6, 2009 7:08:07 PM EDT by David Hammond Comments |
June 28, 2010 -- Modern Signal launches redeveloped website for National Health Policy Forum, a nonpartisan research and public policy organization at The George Washington University. The new site includes admin tools to manage email announcements, event invitations and RSVPs, surveys, and an extensive library of publications and meeting materials. The site also features a customized Google Search integration, and a new content management system was integrated within the existing design and information architecture of the site. -View-
April 22, 2010 -- Modern Signal launches a redesigned website for The NALP Foundation for Law Career Research and Education, a nonprofit organization that works to ensure that the legal community and society at large have a reliable, objective, and affordable source of information.The site includes a content management system; bookstore; and news, events, leadership, and products tools to manage the featured homepage content. -View-
April 5, 2010 --
|
||||