CFXML exception
admin
Lately I've been coding a lot of traditional HTML tables with SPRY. I transform cfquery data into XML using Spry.Data.XMLDataSet. For whatever reason I find it easier than using a JSON object. Over the last couple of weeks I periodically come across one of the following error messages:
or
Ahhhhhrrrrrrrrggggggggg!!!!!!! So for the past week (one day I spent 5 hours on it) I've been looking over where the error is in the data and I've come to this conclusion. When an apersand exists in a datacolumn which is immediately followed by any letter the first error occurs. And when the apersand is bounded by spaces the second error occurs. At least this is what my data showed. So how to fix it. I work for a commercial vehicle leasing company so the XML will reflect that type of data. Fix 1 (this fix removes the Ampersand reference and replaces it with ' and ':
| Diagnostics: | An error occured while Parsing an XML document. The reference to entity "foobar" must end with the ';' delimiter. The error occurred on line 69. |
| Diagnostics: | An error occured while Parsing an XML document. The The entity name must immediately follow the '&' in the entity reference. The error occurred on line 69. |
Ahhhhhrrrrrrrrggggggggg!!!!!!! So for the past week (one day I spent 5 hours on it) I've been looking over where the error is in the data and I've come to this conclusion. When an apersand exists in a datacolumn which is immediately followed by any letter the first error occurs. And when the apersand is bounded by spaces the second error occurs. At least this is what my data showed. So how to fix it. I work for a commercial vehicle leasing company so the XML will reflect that type of data. Fix 1 (this fix removes the Ampersand reference and replaces it with ' and ':
<yrmakemodel>#replace('2004 Ford F-250 w/plow&spreader', '&',' and ','ALL')#</yrmakemodel>
Fix 2 (this fix keeps the Ampersand reference) but It may cause some performance issues depending on the depth of the data. At least thats out experience.
<yrmakemodel><![CDATA[2004 Ford F-250 w/plow&spreader]]></yrmakemodel>
Posted in Spry |
4 comments