A reader this morning asked me if there was a way to check if a block of text was XML. My initial reaction was to say “just use the IsXML() function”, but that I checked and discovered that CFML does not have an IsXML() function. It has an IsXMLDoc() function, but that checks to see if a passed value is an XML DOM, it will not check a string of text to determine if it contains XML. I’d consider this an oversight, CFML needs an IsXML() function, but for now I whipped up a really simple UDF for the reader. In case any of you could use the code, here it is. (This is a quick and dirty solution that took all of 60 seconds to code and test, if you have a more elegant one please share):
Leave a Reply