I built an XML generator using the second method, because it seemed "right". However, with the many deep, and optional, levels, it was a pain to keep everything organized.
I couldn't tell any huge difference in performance between using the function-only style versus creating a string. If I do it over again, I will probably not use the function-only syntax just because it is more difficult to maintain, not to mention the amount of time to build and debug. M!ke -----Original Message----- From: Bud [mailto:[EMAIL PROTECTED] Sent: Friday, January 13, 2006 6:04 PM To: CF-Talk Subject: Building XML Hi everyone. Happy new (almost) year. I'm curious what you experts think is the best way to create XML. Just taking dummy XML and populating it? <cfset myxml ='<CustomerRequest> <BillAddress> <Addr1>#Address1#</Addr1> <City>#City#</City> <State>#State#</State> <PostalCode>#Zip#</PostalCode> </BillAddress> </CustomerRequest>'> <cfset myxml = xmlParse(myxml)> Or using CF functions? <cfset myxml = xmlNew()> <cfset myxml.xmlRoot = xmlElemNew(myxml, 'CustomerRequest')> <cfset myxml.CustomerRequest.xmlChidren[1] = xmlElemNew(myxml, 'BillAddress')> <cfset myxml.CustomerRequest.BillAddress.xmlChidren[1] = xmlElemNew(myxml, 'Addr1')> <cfset myxml.CustomerRequest.BillAddress.xmlChidren[2] = xmlElemNew(myxml, 'City')> <cfset myxml.CustomerRequest.BillAddress.xmlChidren[3] = xmlElemNew(myxml, 'State')> <cfset myxml.CustomerRequest.BillAddress.xmlChidren[4] = xmlElemNew(myxml, 'PostalCode')> <cfset myxml.CustomerRequest.BillAddress.Addr1.xmlText = Address1> <cfset myxml.CustomerRequest.BillAddress.City.xmlText = City> <cfset myxml.CustomerRequest.BillAddress.State.xmlText = State> <cfset myxml.CustomerRequest.BillAddress.PostalCode.xmlText = Zip> It seems like the first way would take less time, less overhead and be less confusing. But somehow it seems like the second way is the "right" way. Opinions? -- Bud Schneehagen - Tropical Web Creations, Inc. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:229550 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=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

