>- see footer for list info -<
Alas that one doesn't do nested structures. 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Robertson-Ravo, Neil (RX)
> Sent: 22 December 2004 15:46
> To: Coldfusion Development
> Subject: RE: [CF-Dev] Struct to XML
> 
> >- see footer for list info -<
> Enjoy.....
> 
> function StructToXML(structHandle){
>          //only one level structs supported
>          var includeXMLHeader = 1;
>          var TopLevelElement = 'alldata';
>          var output = '';
>          if(arrayLen(arguments) gt 1){
>                  if(isBoolean(arguments[2])){
>                          includeXMLHeader = arguments[2];
>                  }
>                  if(arrayLen(arguments) gt 2){
>                          if(isSimpleValue(arguments[3])){
>                                  TopLevelElement = arguments[3];
>                          }
>                  }
>          }
> 
>          if(isStruct(structHandle)){
>                  //if struct is a form handle, reduce clutter
>                  if(structkeyexists(structHandle,'fieldnames') ){
>                          fieldnames= 
> StructFind(structHandle,'fieldnames');
>                          StructDelete(structHandle, 'fieldnames',0);
>                  }
>                  if(includeXMLHeader){output = "<?xml 
> version='1.0'?><#toplevelElement#>";}
>                          else{output = "<#toplevelElement#>";}
>                  for(thisKey in structHandle){
>                          thisKey=lcase(thisKey);
>                          thisVal =
> iif(isSimpleValue(structHandle[thisKey]), 
> DE(structHandle[thisKey]), DE(''));
>                          safeVal = iif(find('<',thisVal,1) or 
> find('>',thisVal,1), DE('<![CDATA[#thisVal#]]>'), DE(thisVal));
>                          output = output & 
> "<#thisKey#>#safeVal#</#thisKey#>";
>                  }
>                  if(includeXMLHeader){output = output & 
> "</#toplevelElement#>";}
>                  return output;
>          } else return '';
> }
> </cfscript>
> 
> 
> 
> http://www.cflib.org/udf.cfm?ID=573
> 
> 
> 
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Russ Michaels
> (Snake)
> Sent: 22 December 2004 15:46
> To: 'Coldfusion Development'
> Subject: [CF-Dev] Struct to XML
> 
> >- see footer for list info -<
> Anybody done a handy dandy UDF or tag to convert CF structs to XML....
> Or am I gonna have to write one?
> 
> Russ
> 
> 
> _______________________________________________
> 
> For details on ALL mailing lists and for joining or leaving 
> lists, go to http://list.cfdeveloper.co.uk/mailman/listinfo
> 
> --
> CFDeveloper Sponsors:-
> >- Hosting provided by www.cfmxhosting.co.uk -<
> >- Forum provided by www.fusetalk.com -<
> >- DHTML Menus provided by www.APYCOM.com -<
> >- Lists hosted by www.Gradwell.com -<
> >- CFdeveloper is run by Russ Michaels, feel free to 
> volunteer your help 
> >-<
> This e-mail is from Reed Exhibitions (Oriel House, 26 The 
> Quadrant, Richmond, Surrey, TW9 1DL, United Kingdom), a 
> division of Reed Business, Registered in England, Number 
> 678540.  It contains information which is confidential and 
> may also be privileged.  It is for the exclusive use of the 
> intended recipient(s).  If you are not the intended 
> recipient(s) please note that any form of distribution, 
> copying or use of this communication or the information in it 
> is strictly prohibited and may be unlawful.  If you have 
> received this communication in error please return it to the 
> sender or call our switchboard on +44 (0) 20 89107910.  The 
> opinions expressed within this communication are not 
> necessarily those expressed by Reed Exhibitions.
> Visit our website at http://www.reedexpo.com 
> _______________________________________________
> 
> For details on ALL mailing lists and for joining or leaving 
> lists, go to http://list.cfdeveloper.co.uk/mailman/listinfo
> 
> --
> CFDeveloper Sponsors:-
> >- Hosting provided by www.cfmxhosting.co.uk -<
> >- Forum provided by www.fusetalk.com -<
> >- DHTML Menus provided by www.APYCOM.com -<
> >- Lists hosted by www.Gradwell.com -<
> >- CFdeveloper is run by Russ Michaels, feel free to 
> volunteer your help 
> >-<
> 


_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to