You could use a regular expression to parse the data, then set it to a
variable for inserting into your database.

<cfset XMLData = cfhttp.response>

<cfset VarLen = Len("<string xmlns="http://tempuri.org/";>")>            
<cfset Start = REFind("<string xmlns="http://tempuri.org/";>",XMLData) +
VarLen>
<cfset End = REFind("</string>",XMLData)>       
<cfset Diff = End - Start>
<cfset CustID = Mid(XMLData, Start, Diff)>
CustID: <cfoutput>#CustID#</cfoutput><br>

Insert into Database 
(CustomerID)
Values
(#CustID#)

Probably not the most effective way to work with XML, but it should work
Cheers

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 11, 2001 7:21 PM
To: CF-Talk

Subject: How do you parse an XML response


How would you parse the following XML response to a CFHTTP post to:

1. Extract and insert only the CUSTOMER ID number into the database and
2. also use it for a new CFHTTP post command in the same script?


EXAMPLE RESPONSE FROM SERVER TO WHICH I POST VIA CFHTTP:

<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/";>892028</string>


The only thing I want to extract is the "892028" number which is the new
custID for a new long distance phone service customer.

Then need to use that number to insert addl. telephone lines into another
table on the vendors server.

To insert 10 phone numbers, is it better to use 10 CFHTTP parameter
variables in the script or use some loop logic?

I have no experience with parsing text or loops.

Thanks,
Pardeep.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to