Link to home
Create AccountLog in
Avatar of seeraig
seeraig

asked on

Coldfusion XML

Trying to extract some xml data and having some problems. I'm using CFHTTP to send data and then reading the xml response. I just need to grab the "InvQTY" number from the xml response, what is the best way to do that (i've attached a pic of the xml output). Here is my code which is not working:

<cfset myxml = XmlParse(CFHTTP.FileContent)>

<cfset myxml = XmlParse(CFHTTP.FileContent)>
<cfdump var="#myxml#">
                  
<CFSET GetInv = xmlSearch(myxml,'/InvQty')>
<CFSET QtyXML = xmlparse(GetInv) />
<CFSET InventoryQTY = QtyXML.xmlText>


 User generated image User generated image
Avatar of _agx_
_agx_
Flag of United States of America image

> <cfset myxml = XmlParse(CFHTTP.FileContent)>
> <cfdump var="#myxml#">

If that returns an "InvQty" node you should just be able to use:

          #myXML.xmlType#

If not, can you post an example of the CFHTTP.FileContent string?
Btw: Why is this question under Jscript?
Avatar of seeraig
seeraig

ASKER

Unfortunately that didn't work. This is my code and the InventoryQty variable returns the word 'Document'. If I just output the CFHTTP.FileContent variable, i get back the InvQty amount (25 in this example). But when I do an isnumeric on the CFHTTP.FileContent variable, it comes back as 'NO'.

<CFOUTPUT>

<cfset myxml = XmlParse(CFHTTP.FileContent)>
<cfdump var="#myxml#">
<CFSET InventoryQTY = #myXML.xmlType#>

Inventory - #InventoryQTY#

</CFOUTPUT>

Avatar of seeraig

ASKER

Here is the http post so you can just see everything and see the response and probably figure it out way easier:

<CFHTTP METHOD="POST" URL="http://affiliate.strawberrynet.com/affiliate/cgi/QTYResponse.asp?ProdId=126496" THROWONERROR="YES">
</CFHTTP>
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer