Hi, well I made my first cfquery to xml,and I am wondering what are best
practices for naming the xml nodes? Should they be the same as the database
headers?
Also, if I want to read the values is it better to save the file(which is done)
or just run this file? I am planning to try to write a tree in using flex using
the data, which I think using xml is easier in flex than using the query.
Thanks so much, here is the code:
<cfquery name="qGetmembersList" datasource="myDatasource">
SELECT FirstName,LastName,EmailAddress
FROM members
</cfquery>
<cfset tempxml = "<?xml version =""1.0""?>
<members>">
<cfloop query="qGetmembersList">
<cfset tempxml = "#tempxml#
<FirstName>#Trim("#XMLFormat(FirstName)#")#</FirstName>
<LastName>#Trim("#XMLFormat(LastName)#")#</LastName>
<EmailAddress>#Trim("#XMLFormat(EmailAddress)#")#</EmailAddress>
">
</cfloop>
<cfset tempxml = "
#tempxml#
</members>">
<P> This is the XML output that as been generated by ColdFusion!</P>
<cfoutput>
<xmp>
#tempxml#
</xmp>
</cfoutput>
<!---write out the XML --->
<cfset writePath=#ExpandPath("memberslist.xml")#>
<!--- save the xml file--->
<cfoutput>
The file was written to #writePath#<br />
<cffile action = "Write" file="#writePath#" output="#tempxml#">
</cfoutput>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4555
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15