Hey all,

I'm trying to build a couple functions that can recursively go over any 
query or structure (including unlimited nested values as well) and output an 
xml doc based off of it. It hasn't been polished or optimized, but heres 
what I have thus far...

<!--- START CODE --->
 <cffunction name="recurseNestedStructure" returntype="string" 
access="private" output="false">
  <cfargument name="s" required="true" />
  <cfargument name="xml" type="string" required="true"/>
  <cfset var i = "">
  <cfloop collection="#s#" item="i">
   <cfif isStruct(s[i])>
    <cfset xml = xml & "<struct label=""#i#"" data=""0"" 
iconID=""struct_icon"">">
    <cfset xml = recurseNestedStructure(s[i], xml)>
    <cfset xml = xml & "</struct>">
   <cfelseif isArray(s[i])>
    <cfset xml = xml & "<array label=""#i#"" data=""0"" 
iconID=""array_icon"">">
    <cfset xml = recurseNestedStructure(s[i], xml)>
    <cfset xml = xml & "</array>">
   <cfelseif isQuery(s[i])>
    <cfset xml = xml & "<query label=""#i#"" data=""0"" 
iconID=""query_icon"">">
    <cfset xml = recurseNestedQuery(s[i], xml)>
    <cfset xml = xml & "</query>">
   <cfelse>
    <cfset xml = xml & "<string label=""#i#"" data=""0"" 
value=""#XMLFormat(s[i])#"" iconID=""prop_icon""/>">
   </cfif>
  </cfloop>
  <cfreturn xml>
 </cffunction>
 <cffunction name="recurseNestedQuery" returntype="string" access="private" 
output="false">
  <cfargument name="s" type="query" required="true" />
  <cfargument name="xml" type="string" required="true"/>
  <cfset var cols = ListToArray(s.columnlist)>
  <cfset var i = 1>
  <cfloop query="s">
   <cfset xml = xml & "<row label=""#i#"">>">
   <cfloop from="1" to="#arraylen(cols)#" index="item">
    <cfif isStruct(s[cols[item]])>
     <cfset xml = xml & "<struct label=""#cols[item]#"" data=""0"" 
iconID=""struct_icon"">">
     <cfset xml = recurseNestedStructure(s[cols[item]], xml)>
     <cfset xml = xml & "</struct>">
    <cfelseif isArray(s[cols[item]])>
     <cfset xml = xml & "<array label=""#cols[item]#"" data=""0"" 
iconID=""array_icon"">">
     <cfset xml = recurseNestedStructure(s[cols[item]], xml)>
     <cfset xml = xml & "</array>">
    <cfelseif isQuery(s[cols[item]])>
     <cfset xml = xml & "<query label=""#cols[item]#"" data=""0"">">
     <cfset xml = recurseNestedQuery(s[cols[item]], xml)>
     <cfset xml = xml & "</query>">
    <cfelse>
     <cfset xml = xml & "<string label=""#XMLFormat(cols[item])#"" 
data=""0"" value=""#s[cols[item]]#"" iconID=""prop_icon""/>">
    </cfif>
   </cfloop>
   <cfset i = i +1>
   <cfset xml = xml & "</row>">
  </cfloop>
  <cfreturn xml>
 </cffunction>
<!--- END CODE --->

Any insight into why this is bombing out? I'm stumped...

Sincerely,

Kevin 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206781
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to