The Good Side of ColdFusion
I have to say of all the negatives that I am seeing with ColdFusion, there are a few breaks in the clouds. XML processing is extremely easy to use and I actually prefer it over PHP's xml processing. Perhaps it is just that the syntax is extremely easy, or what I am trying to do is even easier, but this has to be the best XML processing of any language I have ever used.
On TonerMax we over use the database to the point where we are getting to the breaking point. There are quite a few sites that are running on the DB and File Server, so I am trying to squeeze as much performance out of the system as I can find. One of the ways that I am trying is to save certain queries that don't change very often into and XML file, and then parse the XML rather than create a new query on every page load.
For instance, on the first page of the site, there is a Brand drop down. Though the data may change occasionally, it is basically static. Instead of running a query to my database on every page load that it comes up, I am scheduling the query to run daily, and saving the results to an XML file.
The only really tricky thing here is to trim the whitespace from the xml output, as it causes the parser a bit of a problem when it is read. I just have this scheduled to run at Midnight or so, to pick up any new brands that might have been entered into the system.
Now, for the easy peasy part. Reading my XML. I just created a Debug script, which shows my output:
In this, I throw my xml file into my xmlvar. From there, I just have to loop through my brand list to grab my attributes and text. Nothing could be easier.
This gives me a very nice loop of my brands, which isn't nearly as resource intensive, but still is better than hardcoding the results.
Hat's off to CF for the ease of XML processing.
There are no comments attached to this item.