Question
Error handling an empty structure
I have a web app that queries a database and returns the
results in XML. I used SOXML - XML2CF to convert the XML to a CF
Structure. Everything works great if there are hits and the XML
contains results. If there are no results, the app fails. What I
need is to check the structure for the existance of data before
trying to display the results.
Here's what I have...
<cf_soxml action="XML2CF" input="#CFHTTP.FileContent#" output="jobPostings">
<cfset availJobs = jobPostings.root["Job"]>
If there are no results to display, I get this...
The object JOB is not present in the scope named JOBPOSTINGS.ROOT.
Anyone know how I can search the structure for the existance of ROOT.JOB so I can display a message if there are no results?
Thanks,
Joe
Here's what I have...
<cf_soxml action="XML2CF" input="#CFHTTP.FileContent#" output="jobPostings">
<cfset availJobs = jobPostings.root["Job"]>
If there are no results to display, I get this...
The object JOB is not present in the scope named JOBPOSTINGS.ROOT.
Anyone know how I can search the structure for the existance of ROOT.JOB so I can display a message if there are no results?
Thanks,
Joe