First way.  Hands down.  Though I'd probably use CFCONTENT instead of
CFSET.  Or even CFXML, if you need an XML doc, rather than a string.

cheers,
barneyb

On 1/13/06, Bud <[EMAIL PROTECTED]> wrote:
> 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?

--
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 100 invites.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:229537
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