Customer Feedback Processing Using XML
By Randal L. Schwartz
If your organization wants to provide good customer service, receiving feedback and responding to it in a timely manner is important. A Web form is a simple way to handle this processbut then there's all of that nagging stuff about validating the form fields, and writing the data in a nice clean way for later processing. I decided that I could use a table-driven, survey-form generator to handle those tasks, similar to the approach I took in an earlier column (see "Programming With Perl," August 1999). That approach didn't permit me to validate the form responses; so I thought about how I could add some hooks to handle that when necessary.
I initially planned to have my script write the survey forms by appending to a flat file (using proper file locking so that I got clean writes). As I pondered a format in which to save the form fields, I realized that a simple XML structure would do the job nicely. The XML encoding would provide the right clues as to which field went with which value, as well as the ability to escape special characters. What's more, this would mean that standard XML tools could be used for data transformation and reduction. Conveniently, the XML::Simple module from the CPAN lets us construct a typical hash/array-ref tree and worry about the XML conversion at the last minute (if ever). I was quickly convinced that I'd hit pay dirtand the result appears in
|