I am posting a sale request via XML to a certain server. The server then sends back an XML response, which has an element called Status. If the Status element says 'OK' I will need to send the user in one direction. If it does not say 'OK' I will need to send them in another direction. The element's structure is SaleResponse/TransactionData/Status Here is an example of the XML response with Status as 'OK' <?xml version="1.0" standalone="yes" ?> - <SaleResponse> - <CustomerData> <Email>webnutrition@strictlyhealth.com</Email> - <BillingAddress> <Address1>tes</Address1> <City>test</City> <FirstName>test261</FirstName> <LastName>test</LastName> <State>TN</State> <Zip>test</Zip> <Country>United States</Country> <Phone>test</Phone> </BillingAddress> - <ShippingAddress> <Address1 /> <City /> <FirstName /> <LastName /> <State /> <Zip /> <Country /> <Phone /> </ShippingAddress> - <AccountInfo> - <CardInfo> <CCLastFour>5454</CCLastFour> <CCName>MasterCard</CCName> </CardInfo> </AccountInfo> </CustomerData> - <TransactionData> <Status>OK</Status> <ErrorCategory /> <ErrorMessage /> <WarningMessage /> <AuthCode>000000</AuthCode> <AVSCategory /> <AVSResponse /> <CVV2Response /> <TimeStamp>20081007135612</TimeStamp> <TestMode>1</TestMode> <Total>59.90</Total> <XID>9999999999</XID> - <RecurringData> <RecurRecipe /> <RecurReps /> <RecurTotal /> <RecurDesc /> </RecurringData> </TransactionData> </SaleResponse> I have tried this: <cfset xmlfile = xmlparse(cfhttp.filecontent)> <cfset status = xmlfile.SaleResponse.TransactionData[1].Status[1].xmltext> and this: <cfscript> status = XmlSearch(xmlfile, "saleresponse/transactiondata"); </cfscript> Nothing has worked for me. I either get this error: The XML page cannot be displayed Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later. -------------------------------------------------------------------------------- Invalid at the top level of the document. Error processing resource 'https://www.hoodia-dietpills.com/sale2test.cfm?shipmet... Or I get an error saying I can't use complex values as simple values. Can anyone help??
Setup: 0. Latest version of CF8 1. I took your xml file and made it into a file on the file system. 2. I read the file in using CFFILE Code: <cffile action="READ" file="#expandpath('.')#\xml.xml" variable="_file"> <cfset _xml = XMLParse(_file)> <cfoutput> #_xml.SaleResponse.TransactionData.status.xmlText# </cfoutput> Output: OK Work just fine. If you want to iterate over the entire thing, just loop over the array of SaleResponse items.