Skip to main content
Inspiring
June 10, 2009
Answered

CFHTTP.FileContent

  • June 10, 2009
  • 1 reply
  • 1072 views

Hello I have the below, when the file is read  firstchild.XMLName returne "errors" but the actual line of the CFHTTP.FileContent returned is

400 xxxx, xxxxxxx xxxxxx.

What I can not figure out is the word errors found in the "<cfelseif firstchild.XMLName is 'errors'>"

<cfhttp url="xxxxx" method="POST" resolveurl="No" throwonerror="Yes">
            <cfhttpparam name="xxxxx" type="Formfield" value="#xxxx#">
            <cfhttpparam name="xxxx" type="Formfield" value="#xxxxx#">

</cfhttp>

        <cfset xmlfile = CFHTTP.FileContent>
        <Cfset MYXML = XmlParse(xmlfile)>
        <cfset XMLResponseBook = MYXML.xmlroot>
        <cfset numchildren = arraylen(XMLResponseBook.XmlChildren)>
        <cfset firstchild = XMLResponseBook.XmlChildren>
        <cfset numgrandkids = arraylen(firstchild.XmlChildren)>

       
        <cfloop from="1" to="#numchildren#" index="i">

            <cfset firstchild = XMLResponseBook.XmlChildren>
            <cfset numgrandkids = arraylen(firstchild.XmlChildren)>
            <cfif firstchild.XMLName is 'confirmation'>
                <cfset confirmation = firstchild.XmlText>
            <cfelseif firstchild.XMLName is 'errors'>
                <cfset errid = grandkid.XmlChildren.XmlText>
            </cfif>
        </cfloop>

        <cfset xmlfile = CFHTTP.FileContent>
        <Cfset MYXML = XmlParse(xmlfile)>
        <cfset XMLResponseBook = MYXML.xmlroot>
        <cfset numchildren = arraylen(XMLResponseBook.XmlChildren)>

    This topic has been closed for replies.
    Correct answer ilssac

    This code is expecting an XML document to be returned by the request.

    The request is not returning an XML document, it is returning an HTTP 400 file not found error response.

    The code is chocking because it can not parse a 400 file not found error response as an XML document.

    1 reply

    ilssac
    ilssacCorrect answer
    Inspiring
    June 10, 2009

    This code is expecting an XML document to be returned by the request.

    The request is not returning an XML document, it is returning an HTTP 400 file not found error response.

    The code is chocking because it can not parse a 400 file not found error response as an XML document.