Thanks Kola,
I have checked that the query returns multiple records - and it does.
I am using CF5.
I can write & read the xml file - but as you suggest the <cfloop..> is 
getting ignored (I think).
This is my xml file
- <xmp>
<?xml version="1.0" ?>
- <stock_levels>
<CustomerID>1</CustomerID>
- <stock_details>
- <cfloop query="get_data">
<item ProductCode="A8-1" ProductDescription="As A Matther of Fact (32)" 
StockLevel="4992" />
</cfloop>
</stock_details>
</stock_levels>
</xmp>

Any help gratefully received

(I tried cfsavecontent but can't get the stuff within the cfloop to get 
interpreted)




At 22:27 11/12/02 , you wrote:
>Seamus
>
>I think your problem is that you have coldfusion tags inside the string
>being set to tempxml and is thus being ignored instead of interpreted.
>What version of cf are you using? If you are using CF5 you can use
>cfsavecontent to wrap the output instead of using cfset.
>
>In CFMX I think there are some XML functions which should allow you to
>do this more cleanly.
>
>Finally It may sound silly but double check that the query actually
>returns multiple rows.
>
>HTH
>
>Kola
>
> >> -----Original Message-----
> >> From: Seamus Campbell [mailto:[EMAIL PROTECTED]]
> >> Sent: 11 December 2002 11:02
> >> To: CF-Talk
> >> Subject: xml question
> >>
> >> Hi
> >> I'm grappling with some xml
> >> I want to export data from my database in an xml file but I only get
>the
> >> 1st record
> >> I'm doing this: (but I can't see how to loop over each record)
> >>
> >> <cfquery name="get_data" datasource="#request.main_dsn#"
>dbtype="ODBC">
> >> SELECT tblWEBSTOCKLEVEL.CustomerID, tblWEBSTOCKLEVEL.ProductCode,
> >> tblWEBSTOCKLEVEL.ProductDescription, tblWEBSTOCKLEVEL.StockLevel
> >> FROM tblWEBSTOCKLEVEL
> >> WHERE (((tblWEBSTOCKLEVEL.CustomerID)=1));
> >> </cfquery>
> >>
> >> <!--- create a temporary variable to hold XML document --->
> >> <cfset tempxml="<?xml version ""1.0""?>
> >> <stock_levels>
> >> <CustomerID>#trim("#XMLFormat(get_data.CustomerID)#")#</CustomerID>
> >> <stock_details>
> >> <cfloop query=""get_data"">
> >> <item
> >> ProductCode=""#trim("#XMLFormat(get_data.ProductCode)#")#""
> >>
>ProductDescription=""#trim("#XMLFormat(get_data.ProductDescription)#")#"
>"
> >> StockLevel=""#trim("#XMLFormat(get_data.StockLevel)#")#""/>
> >> </cfloop>
> >> </stock_details>
> >> </stock_levels>
> >> ">
> >>
> >> Can anyone help me please with the looping needed to get each record
> >> rather
> >> than just the first one.
> >> Many thanks
> >> Seamus
> >>
> >>
> >>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

Reply via email to