|
|
|
knowledge base
Parsing the GetData Response
using ColdFusion
|
|
|
|
Parsing the GetData Response using ColdFusion
|
Date :
19th August 2005
Reference :
#PB0001
Symptom :
Unable to access the root <xmlresponse>
node from the GetData response XML.
Cause :
ColdFusion reserves any items prefixed with
"xml" for built-in functions. For example, "mynode.XmlText" returns the text
contents of the node "mynode".
Resolution :
Before parsing the xml response string,
replace all occurrences of "xmlresponse" with "response" or a name of your
choice. Then, whenever referencing the root <xmlresponse> node from the
xml structure simply reference it using <response> or your chosen name.
Example :
<!--rename the <xmlresponse> node to
<response>-->
<cfset variables.responseXml =
Replace(variables.responseXml, "xmlresponse", "response", "ALL")>
<!--parse the response-->
<cfset variables.responseXml =
xmlparse(variables.responseXml)>
<!--process the <result> node of the
response-->
<cfset variables.resultsXml =
variables.responseXml.response.body.results.result>
|
|
|
|
|
|
|