true :) just fguring if the position of the custid ever changed, this option should scale with it to fix itself without changing any code.
-----Original Message----- From: BILLY CRAVENS [mailto:[EMAIL PROTECTED]] Sent: Friday, December 14, 2001 3:55 PM To: CF-Talk Subject: Re: How to take only a CUSTID number from XML code Yeah, but wouldn't the overhead of instantiating the object be overkill with such a little packet? --- Billy Cravens ----- Original Message ----- From: "Scott Mulholland" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Friday, December 14, 2001 2:53 PM Subject: RE: How to take only a CUSTID number from XML code > You could actually parse the xml using something similar to the following: > > <cfset XML = cfhttp.filecontent> > > <!---Call Microsoft XML Parser---> > <CFOBJECT TYPE="COM" NAME="objSource" CLASS="Microsoft.XMLDOM" > ACTION="CREATE"> > > <!--- load XML source and check readyState ---> > <CFSET objSource.async = "false"> > <CFSET sourceReturn = objSource.loadXML(XML)> > <CFSET sourceReady = objSource.readyState> > > <CFSET child_nodes = objSource.getElementsByTagName("string")> > > <CFLOOP COLLECTION="#child_nodes#" ITEM="anElement"> > <CFSET CUSTID = anElement.text> > </CFLOOP> > > > > -----Original Message----- > From: BILLY CRAVENS [mailto:[EMAIL PROTECTED]] > Sent: Friday, December 14, 2001 3:27 PM > To: CF-Talk > Subject: Re: How to take only a CUSTID number from XML code > > > It's a hack, but it should work: > > <cfscript> > xml = cfhttp.fileContent; > pos1 = find("<string",xml); > pos2 = find(">",xml,pos1); > xml=removeChars(xml,1,pos2); > pos3 = find("</string",xml); > str = removeChars(xml,pos3,len(xml)); > </cfscript> > > When I grow up, I'll become a RegEx guru :-) > > --- > Billy Cravens > > > ----- Original Message ----- > From: <[EMAIL PROTECTED]> > To: "CF-Talk" <[EMAIL PROTECTED]> > Sent: Friday, December 14, 2001 2:06 PM > Subject: Re: How to take only a CUSTID number from XML code > > > > How would you take out only the customer ID number from the following XML > > response from a CFHTTP post: > > > > This is the response that comes from the server we do the CFHTTP post to. > > > > > > <?xml version="1.0" encoding="utf-8"?> > > <string xmlns="http://tempuri.org/">892028</string> > > > > > > We need to take out only the '892028' number and insert it into our > > database. Right now it tries to insert all the XML code. The customer ID > is > > always in the same place in the code as far as position in the code. > Thanks > > in advance for any help. > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists